:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(17, 24, 39, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-primary: #3b82f6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --font-main: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;
    --glow-color: rgba(59, 130, 246, 0.15);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Login Screen */
#login-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #1e1b4b 0%, var(--bg-color) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    text-align: center;
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(59, 130, 246, 0.25);
}

.login-card h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--glow-color);
    background: rgba(31, 41, 55, 0.8);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: var(--accent-success);
}
.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: var(--accent-warning);
}
.btn-warning:hover {
    background: #d97706;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: var(--accent-error);
}
.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
    box-shadow: none;
}

/* Error Message overlay */
.error-toast {
    background: var(--accent-error);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    display: none;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Dashboard Core Layout */
#app-layout {
    display: none;
    flex-direction: column;
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-section h1 span {
    color: var(--accent-primary);
    -webkit-text-fill-color: var(--accent-primary);
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.uptime-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(31, 41, 55, 0.6);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--card-border);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Overview Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-footer {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Detail Panel Grid */
.dashboard-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-detail-grid {
        grid-template-columns: 1fr;
    }
}

.section-card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Diagnostics List */
.diag-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.diag-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.diag-item:last-child {
    border-bottom: none;
}

.diag-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.diag-val {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Accounts Table */
.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
}

td {
    padding: 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.action-group {
    display: flex;
    gap: 0.4rem;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

.action-btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    width: auto;
    height: auto;
}

/* Console Logs */
.console-box {
    background: #05070c;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
    height: 500px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.log-entry {
    white-space: pre-wrap;
    word-break: break-all;
}

.log-info { color: #3b82f6; }
.log-warn { color: #f59e0b; }
.log-error { color: #ef4444; }
.log-debug { color: #10b981; }

.console-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Modal Overlays */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 1rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.75rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 1.25rem;
}

.checkbox-group input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

/* ── TOAST NOTIFICATIONS ── */
#notification-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10000;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 3rem);
}

.notification {
    pointer-events: auto;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--accent-primary);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    color: var(--text-primary);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 16px -8px rgba(0, 0, 0, 0.5);
    transform: translateX(120%);
    transition: 
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
        opacity 0.4s ease, 
        height 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
        padding 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
        margin 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        border-width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left-color: var(--accent-success);
    background: linear-gradient(to right, rgba(16, 185, 129, 0.08), rgba(17, 24, 39, 0.85));
}

.notification.error {
    border-left-color: var(--accent-error);
    background: linear-gradient(to right, rgba(239, 68, 68, 0.08), rgba(17, 24, 39, 0.85));
}

.notification.warning {
    border-left-color: var(--accent-warning);
    background: linear-gradient(to right, rgba(245, 158, 11, 0.08), rgba(17, 24, 39, 0.85));
}

.notification.info {
    border-left-color: var(--accent-primary);
    background: linear-gradient(to right, rgba(59, 130, 246, 0.08), rgba(17, 24, 39, 0.85));
}

.notification-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.toast-svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}
.toast-svg.success-icon { stroke: var(--accent-success); }
.toast-svg.error-icon { stroke: var(--accent-error); }
.toast-svg.warning-icon { stroke: var(--accent-warning); }
.toast-svg.info-icon { stroke: var(--accent-primary); }

.notification-content {
    flex-grow: 1;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
    padding-right: 0.5rem;
    word-break: break-word;
}

.notification-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease, color 0.2s ease;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    margin-top: -1px;
}

.notification-close:hover {
    opacity: 1;
    color: var(--text-primary);
}

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
}

.notification.success .notification-progress {
    background: var(--accent-success);
}
.notification.error .notification-progress {
    background: var(--accent-error);
}
.notification.warning .notification-progress {
    background: var(--accent-warning);
}
.notification.info .notification-progress {
    background: var(--accent-primary);
}

@keyframes shrinkProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}
