/* ==========================================================================
   PPanel Clean Light Emerald Theme
   ========================================================================== */

:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-light: #ecfdf5;
    --primary-dark: #047857;
    --accent: #059669;
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-focus: #10b981;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --status-online-bg: #d1fae5;
    --status-online-text: #065f46;
    --status-online-border: #a7f3d0;
    
    --status-offline-bg: #fee2e2;
    --status-offline-text: #991b1b;
    --status-offline-border: #fca5a5;
    
    --status-checking-bg: #fef3c7;
    --status-checking-text: #92400e;
    --status-checking-border: #fde68a;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ---------------- Navbar ---------------- */
.navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.brand-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    letter-spacing: 0.5px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ---------------- Container & Layout ---------------- */
.container {
    max-width: 1440px;
    margin: 24px auto;
    padding: 0 24px;
}

/* ---------------- Stat Cards ---------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-card.primary {
    border-left: 4px solid var(--primary);
}
.stat-card.success {
    border-left: 4px solid #10b981;
}
.stat-card.danger {
    border-left: 4px solid #ef4444;
}
.stat-card.info {
    border-left: 4px solid #3b82f6;
}

/* ---------------- Action Toolbar ---------------- */
.toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.toolbar-left, .toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
    text-decoration: none;
}

.btn-secondary {
    background-color: #ffffff;
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    text-decoration: none;
}

.btn-success {
    background-color: #059669;
    color: white;
}
.btn-success:hover {
    background-color: #047857;
}

.btn-danger {
    background-color: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}
.btn-danger:hover {
    background-color: #ef4444;
    color: white;
}

.btn-outline-green {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border-color: #a7f3d0;
}
.btn-outline-green:hover {
    background-color: #d1fae5;
    text-decoration: none;
}

.btn-sm {
    padding: 4px 9px;
    font-size: 12px;
}

/* ---------------- Table Card ---------------- */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #fbfdff;
}

.table tbody tr.row-offline {
    background-color: #fff8f8;
}
.table tbody tr.row-offline:hover {
    background-color: #feefef;
}

/* ---------------- Badges ---------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.badge-online {
    background-color: var(--status-online-bg);
    color: var(--status-online-text);
    border: 1px solid var(--status-online-border);
}

.badge-offline {
    background-color: var(--status-offline-bg);
    color: var(--status-offline-text);
    border: 1px solid var(--status-offline-border);
}

.badge-checking {
    background-color: var(--status-checking-bg);
    color: var(--status-checking-text);
    border: 1px solid var(--status-checking-border);
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.pulse-online { background-color: #10b981; }
.pulse-offline { background-color: #ef4444; }
.pulse-checking { background-color: #f59e0b; }

/* ---------------- Action Button Group in Row ---------------- */
.actions-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* ---------------- Modals ---------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-box.lg {
    max-width: 880px;
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}
.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* ---------------- Form Elements ---------------- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    color: var(--text-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---------------- Toast Notifications ---------------- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    color: var(--text-main);
    min-width: 280px;
    max-width: 420px;
    animation: slideIn 0.2s ease-out;
}

.toast.toast-error {
    border-left-color: #ef4444;
}

@keyframes slideIn {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---------------- Code block / Snippet ---------------- */
pre.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    overflow-x: auto;
    font-family: Consolas, Monaco, "Courier New", monospace;
}
