/* Settings page layout */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #e0e0e0;
    min-height: 100vh;
}

/* Nav */
.sp-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: rgba(13,13,13,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}
.sp-nav-back {
    color: #aaa;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}
.sp-nav-back:hover { color: #fff; }
.sp-nav-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-nav-title i { color: var(--accent, #e50914); }

/* Layout */
.sp-layout {
    display: flex;
    max-width: 1000px;
    margin: 40px auto;
    gap: 32px;
    padding: 0 20px 80px;
    align-items: flex-start;
}

/* Sidebar */
.sp-sidebar {
    width: 180px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sp-sidelink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #aaa;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sp-sidelink i { width: 16px; text-align: center; font-size: 13px; }
.sp-sidelink:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sp-sidelink.active { background: rgba(255,255,255,0.1); color: #fff; }
.sp-sidelink.active i { color: var(--accent, #e50914); }

/* Main content */
.sp-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Cards */
.sp-card {
    display: none;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 28px;
}
.sp-card.sp-active { display: block; }
.sp-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Rows */
.sp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sp-row:last-child { border-bottom: none; padding-bottom: 0; }
.sp-row:first-of-type { padding-top: 0; }
.sp-row-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.sp-row-label {
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
}
.sp-row-sub {
    font-size: 12px;
    color: #777;
    line-height: 1.4;
}
.sp-row-right {
    justify-content: flex-end;
    border-bottom: none;
    padding-top: 8px;
}
.sp-toggle-row {
    align-items: center;
}
.sp-subsection-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
    margin: 20px 0 4px;
}
.sp-desktop-only { display: flex; }

/* Text button */
.sp-text-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.sp-text-btn:hover { color: #fff; background: rgba(255,255,255,0.07); }

/* Toast */
.sp-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: rgba(40,40,40,0.95);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    font-size: 13px;
    padding: 10px 20px;
    border-radius: 100px;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 9999;
}
.sp-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Override settings-user-card margin inside sp-card */
.sp-card .settings-user-card { margin-bottom: 16px; }
.sp-card .settings-link-row { padding: 13px 0; }

/* Service Status */
.svc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.svc-row:last-child { border-bottom: none; padding-bottom: 0; }
.svc-row:first-of-type { padding-top: 0; }
.svc-left { display: flex; align-items: center; gap: 10px; }
.svc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #444;
    transition: background 0.3s, box-shadow 0.3s;
}
.svc-dot.ok           { background: #22c55e; box-shadow: 0 0 7px rgba(34,197,94,0.55); }
.svc-dot.slow         { background: #f59e0b; box-shadow: 0 0 7px rgba(245,158,11,0.5); }
.svc-dot.down         { background: #ef4444; box-shadow: 0 0 7px rgba(239,68,68,0.5); }
.svc-dot.unconfigured { background: #444; }
.svc-dot.checking     { background: #444; animation: svc-pulse 1.2s ease-in-out infinite; }
@keyframes svc-pulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }
.svc-info { display: flex; flex-direction: column; gap: 2px; }
.svc-name  { font-size: 14px; font-weight: 500; color: #e0e0e0; }
.svc-detail { font-size: 12px; color: #666; min-height: 16px; }
.svc-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 100px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.3s, color 0.3s;
}
.svc-badge.ok           { background: rgba(34,197,94,0.13);  color: #22c55e; }
.svc-badge.slow         { background: rgba(245,158,11,0.13); color: #f59e0b; }
.svc-badge.down         { background: rgba(239,68,68,0.13);  color: #ef4444; }
.svc-badge.unconfigured { background: rgba(255,255,255,0.06); color: #666; }
.svc-badge.checking     { background: rgba(255,255,255,0.04); color: #555; }
.svc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.svc-last-checked { font-size: 12px; color: #555; }

/* Mobile tab strip */
.sp-mobile-tabs {
    display: none;
}
@media (max-width: 640px) {
    .sp-sidebar { display: none; }
    .sp-layout { margin: 8px auto; gap: 0; }
    .sp-card { border-radius: 12px; padding: 20px; }
    .sp-card-title { font-size: 16px; }
    .sp-desktop-only { display: none !important; }
    .settings-swatches { gap: 8px; }

    .sp-mobile-tabs {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        padding: 10px 16px;
        background: rgba(13,13,13,0.85);
        border-bottom: 1px solid rgba(255,255,255,0.08);
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .sp-mobile-tabs::-webkit-scrollbar { display: none; }
    .sp-mobile-tab {
        flex-shrink: 0;
        padding: 7px 14px;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 500;
        color: #aaa;
        background: rgba(255,255,255,0.06);
        border: none;
        cursor: pointer;
        white-space: nowrap;
        transition: background 0.15s, color 0.15s;
    }
    .sp-mobile-tab.active {
        background: var(--accent, #e50914);
        color: #fff;
    }
}
