/**
 * ExtendedFire - Styles
 * Dark theme, Cloudflare-inspired
 */

:root {
    --ef-bg: #0f1115;
    --ef-sidebar-bg: #1a1f2e;
    --ef-panel-bg: #1a1e27;
    --ef-card-bg: #1e2330;
    --ef-border: #2d3548;
    --ef-accent: #f6821f;
    --ef-accent-hover: #ff9a3d;
    --ef-danger: #dc3545;
    --ef-success: #198754;
    --ef-text: #e2e8f0;
    --ef-text-muted: #8492a6;
    --ef-sidebar-w: 220px;
    --ef-topbar-h: 50px;
}

body {
    background: var(--ef-bg);
    color: var(--ef-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
}

/* ── Login ── */
.ef-login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1115 0%, #1a1e27 50%, #161922 100%);
}

.ef-login-card {
    background: var(--ef-panel-bg);
    border: 1px solid var(--ef-border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ── Sidebar ── */
.ef-sidebar {
    width: var(--ef-sidebar-w);
    height: 100vh;
    background: var(--ef-sidebar-bg);
    border-right: 1px solid var(--ef-border);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.ef-sidebar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 0.5rem;
    flex-shrink: 0;
}

.ef-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #2a2f3d transparent;
}
.ef-sidebar-nav::-webkit-scrollbar { width: 4px; }
.ef-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.ef-sidebar-nav::-webkit-scrollbar-thumb { background: #2a2f3d; border-radius: 4px; }

.ef-sidebar .nav-link {
    color: var(--ef-text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 1px;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.ef-sidebar .nav-link:hover {
    color: var(--ef-text);
    background: rgba(255,255,255,0.05);
}

.ef-sidebar .nav-link.active {
    color: #fff;
    background: var(--ef-accent);
}

/* ── Nav Sections (collapsible) ── */
.ef-nav-sep {
    padding: 10px 12px 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #6b7a8d;
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.ef-nav-sep:hover {
    color: #9aa8b8;
}

.ef-sep-icon {
    display: none;
}

.ef-nav-arrow {
    font-size: 0.55rem;
    transition: transform 0.2s;
}

.ef-nav-group {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease;
}

.no-transition .ef-nav-group,
.no-transition .ef-sidebar,
.no-transition .ef-main,
.no-transition .ef-nav-sep {
    transition: none !important;
}

.ef-nav-group.collapsed {
    max-height: 0;
}

.ef-sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-top: 1px solid var(--ef-border);
    flex-shrink: 0;
}

.ef-collapse-btn {
    padding: 2px 6px;
    font-size: 0.75rem;
    border-color: var(--ef-border);
    color: var(--ef-text-muted);
}
.ef-collapse-btn:hover {
    color: var(--ef-text);
    border-color: var(--ef-text-muted);
}

/* ── Sidebar Full Collapse ── */
.sidebar-collapsed .ef-sidebar {
    width: 58px;
    padding: 6px !important;
}
.sidebar-collapsed .ef-sidebar .nav-link span,
.sidebar-collapsed .ef-sidebar-brand span,
.sidebar-collapsed .ef-hide-collapsed,
.sidebar-collapsed .ef-nav-sep span,
.sidebar-collapsed .ef-nav-arrow,
.sidebar-collapsed .ef-sidebar .nav-link .badge {
    display: none !important;
}
.sidebar-collapsed .ef-sidebar .nav-link {
    justify-content: center;
    padding: 0.5rem 0;
    position: relative;
    gap: 0;
}
.sidebar-collapsed .ef-sidebar .nav-link i {
    font-size: 1.15rem;
    margin: 0;
}
.sidebar-collapsed .ef-sidebar-brand {
    justify-content: center;
    padding: 0.5rem 0;
    gap: 0;
}
.sidebar-collapsed .ef-sidebar-brand i {
    font-size: 1.3rem;
}
.sidebar-collapsed .ef-nav-sep {
    height: 1px;
    padding: 0;
    margin: 8px 8px;
    background: var(--ef-border);
    overflow: hidden;
    list-style: none;
    pointer-events: none;
}
.sidebar-collapsed .ef-nav-group {
    max-height: 500px !important;
}
.sidebar-collapsed .ef-sidebar-footer {
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0;
}
.sidebar-collapsed .ef-sidebar-footer .d-flex {
    flex-direction: column;
    gap: 4px;
}
.sidebar-collapsed .ef-main {
    margin-left: 58px;
}
.sidebar-collapsed #collapseIcon {
    transform: rotate(180deg);
}
/* Tooltip on hover when collapsed */
.sidebar-collapsed .ef-sidebar .nav-link:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e2330;
    color: var(--ef-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    z-index: 200;
    border: 1px solid var(--ef-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ── Main ── */
.ef-main {
    margin-left: var(--ef-sidebar-w);
    min-height: 100vh;
    overflow-y: auto;
}

.ef-topbar {
    height: var(--ef-topbar-h);
    border-bottom: 1px solid var(--ef-border);
    background: var(--ef-sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 50;
}

.ef-content {
    min-height: calc(100vh - var(--ef-topbar-h));
    padding-bottom: 2rem;
}

/* ── Cards ── */
.ef-card {
    background: var(--ef-card-bg);
    border: 1px solid var(--ef-border);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s;
}

.ef-card:hover {
    border-color: var(--ef-accent);
}

.ef-card-icon {
    font-size: 1.8rem;
    opacity: 0.9;
}

.ef-card-value {
    font-size: 1.6rem;
    font-weight: 700;
    display: block;
    line-height: 1.2;
}

.ef-card-label {
    font-size: 0.8rem;
    color: var(--ef-text-muted);
}

/* ── Panels ── */
.ef-panel {
    background: var(--ef-panel-bg);
    border: 1px solid var(--ef-border);
    border-radius: 10px;
    padding: 1.25rem;
}

.ef-panel-title {
    color: var(--ef-text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

/* ── Tables ── */
.table {
    color: var(--ef-text);
}

.table thead th {
    border-bottom-color: var(--ef-border);
    color: var(--ef-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
}

.table td {
    border-bottom-color: var(--ef-border);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

/* ── Lists ── */
.ef-list-compact .ef-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--ef-border);
}

.ef-list-compact .ef-list-item:last-child {
    border-bottom: none;
}

.ef-ip {
    font-family: monospace;
    font-size: 0.85rem;
}

/* ── Terminal ── */
.ef-terminal {
    background: #0d1117;
    border: 1px solid var(--ef-border);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: 'Fira Code', monospace;
    color: #58a6ff;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ── Country Grid ── */
.ef-country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

.ef-country-check {
    margin: 0 !important;
    padding: 2px 4px;
}

/* ── Toast ── */
.ef-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
}

.ef-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.ef-toast-success {
    background: var(--ef-success);
    color: #fff;
}

.ef-toast-error {
    background: var(--ef-danger);
    color: #fff;
}

/* ── Forms ── */
.form-control, .form-select {
    background: var(--ef-bg);
    border-color: var(--ef-border);
    color: var(--ef-text);
}

.form-control:focus, .form-select:focus {
    background: var(--ef-bg);
    border-color: var(--ef-accent);
    color: var(--ef-text);
    box-shadow: 0 0 0 0.2rem rgba(246,130,31,0.15);
}

.modal-content {
    background: var(--ef-panel-bg);
    border-color: var(--ef-border);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ef-sidebar {
        width: 58px;
        padding: 6px !important;
    }
    .ef-sidebar .nav-link span,
    .ef-sidebar-brand span,
    .ef-sidebar-footer small,
    .ef-nav-sep span,
    .ef-nav-arrow {
        display: none;
    }
    .ef-sidebar .nav-link {
        justify-content: center;
        padding: 0.5rem 0;
        gap: 0;
    }
    .ef-sidebar-brand {
        justify-content: center;
        gap: 0;
    }
    .ef-main {
        margin-left: 58px;
    }
}
