/* Jupiter Portal — Admin Styles (v4 — sidebar, group cards, edit/delete, search) */

:root {
    --bg-black: #000000;
    --bg-navy: #00243d;
    --brand-red: #ed1c24;
    --brand-blue: #1c75bc;
    --text-light: #f0f4f8;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --sidebar-w: 280px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-black);
    color: var(--text-light);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(28, 117, 188, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(237, 28, 36, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 40% 40% at 20% 50%, rgba(28, 117, 188, 0.04) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: bgShift 20s ease infinite;
}

/* ═══ APP LAYOUT ═══ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 500;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-brand img {
    height: 44px;
    width: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: var(--brand-blue);
    background: rgba(28, 117, 188, 0.08);
    border-left-color: var(--brand-blue);
}

.nav-item svg { flex-shrink: 0; }

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

.sidebar-user {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    background: rgba(237, 28, 36, 0.12);
    border: 1px solid rgba(237, 28, 36, 0.25);
    color: #f87171;
    padding: 0.4rem 0.85rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-logout:hover { background: rgba(237, 28, 36, 0.25); }

/* Hamburger */
.hamburger {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 600;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-light);
    border-radius: 2px;
}

/* ═══ MAIN CONTENT ═══ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
}

/* ═══ SECTIONS ═══ */
.section { display: none; }
.section.active { display: block; }

.section-header { margin-bottom: 1.5rem; }
.section-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.section-header .subtitle { color: var(--text-muted); font-size: 0.95rem; }

/* ═══ STATS GRID ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.stat-card .stat-value.total { color: var(--brand-blue); }
.stat-card .stat-value.pending { color: #fbbf24; }
.stat-card .stat-value.approved { color: #22c55e; }
.stat-card .stat-value.rejected { color: #f87171; }

/* ═══ ACTIONS BAR ═══ */
.actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.actions-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.actions-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.actions-bar .term-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.actions-bar select {
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 0.375rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.actions-bar select:focus { border-color: var(--brand-blue); }
.actions-bar select option { background: #111827; color: var(--text-light); }

/* Search */
.search-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    min-width: 200px;
}

.search-wrap svg { flex-shrink: 0; color: var(--text-muted); }
.search-wrap input {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    width: 100%;
}
.search-wrap input::placeholder { color: var(--text-muted); }

/* Group breadcrumb */
.group-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.group-breadcrumb span { color: var(--text-light); font-weight: 600; }

.btn-text {
    background: none;
    border: none;
    color: var(--brand-blue);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0;
}
.btn-text:hover { text-decoration: underline; }

/* ═══ FILTER BAR ═══ */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-bar button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-bar button:hover,
.filter-bar button.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
}

.filter-bar button.active {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

/* ═══ GROUP CARDS ═══ */
.group-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.group-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-card:hover {
    border-color: var(--brand-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(28, 117, 188, 0.15);
}

.group-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-light);
}

.group-card-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.group-card-stats {
    margin-top: 0.25rem;
}

.group-card-footer {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--brand-blue);
    font-weight: 600;
}

/* ═══ TABLE ═══ */
.table-wrapper {
    overflow-x: auto;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
tbody tr:last-child td { border-bottom: none; }

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-Pending { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.status-Approved { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.status-Rejected { background: rgba(237, 28, 36, 0.15); color: #f87171; }

.action-btn {
    padding: 0.3rem 0.6rem;
    border-radius: 0.375rem;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 0.25rem;
}

.action-btn.approve { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.action-btn.approve:hover { background: rgba(34, 197, 94, 0.25); }
.action-btn.reject { background: rgba(237, 28, 36, 0.15); color: #f87171; border: 1px solid rgba(237, 28, 36, 0.3); }
.action-btn.reject:hover { background: rgba(237, 28, 36, 0.25); }

.action-btn.edit { background: rgba(28, 117, 188, 0.15); color: #60a5fa; border: 1px solid rgba(28, 117, 188, 0.3); }
.action-btn.edit:hover { background: rgba(28, 117, 188, 0.25); }

.action-btn.delete { background: rgba(237, 28, 36, 0.1); color: #f87171; border: 1px solid rgba(237, 28, 36, 0.2); }
.action-btn.delete:hover { background: rgba(237, 28, 36, 0.2); }

.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.file-link {
    color: var(--brand-blue);
    text-decoration: none;
    font-size: 0.8rem;
}
.file-link:hover { text-decoration: underline; }

/* ═══ ALERTS ═══ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: none;
}
.alert.show { display: block; }
.alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #22c55e; }
.alert-error { background: rgba(237, 28, 36, 0.1); border: 1px solid rgba(237, 28, 36, 0.3); color: #f87171; }
.alert-info { background: rgba(28, 117, 188, 0.1); border: 1px solid rgba(28, 117, 188, 0.3); color: #60a5fa; }

/* ═══ EMPTY / LOADING ═══ */
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }
.empty-state p { margin-top: 0.5rem; font-size: 0.95rem; }
.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; opacity: 0.5; }
.loading { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 0.9rem; }

/* ═══ ANALYTICS ═══ */
.analytics-section { margin-top: 2rem; margin-bottom: 2rem; }
.analytics-section h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.analytics-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.analytics-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.analytics-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.875rem;
}
.analytics-row:last-child { border-bottom: none; }
.analytics-label { color: var(--text-muted); }
.analytics-value { font-weight: 700; color: var(--text-light); }
.analytics-big-num {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--brand-blue);
    line-height: 1.1;
}

/* ═══ MODALS ═══ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.show { display: flex; }
.modal-overlay.show { display: flex; }

.modal-card {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    animation: scaleIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-card-wide { max-width: 600px; }
.modal-card-sm { max-width: 420px; text-align: center; }

.modal-card h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 1rem; }
.modal-card h3 { font-size: 1rem; font-weight: 600; color: var(--text-muted); }

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.modal-actions .btn-primary {
    padding: 0.625rem 1.5rem;
    background: var(--brand-red);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}
.modal-actions .btn-primary:hover { background: #d4181f; }

.btn-danger {
    padding: 0.625rem 1.5rem;
    background: rgba(237, 28, 36, 0.15);
    color: #f87171;
    border: 1px solid rgba(237, 28, 36, 0.3);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-danger:hover { background: rgba(237, 28, 36, 0.25); }

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--brand-blue);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn-primary:hover { background: #155a94; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--glass-border);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-success {
    background: rgba(46, 196, 116, 0.15);
    color: #2ec46e;
    border-color: rgba(46, 196, 116, 0.3);
}
.btn-success:hover { background: rgba(46, 196, 116, 0.25); }

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-paid { background: rgba(46, 196, 116, 0.15); color: #2ec46e; }
.status-pending { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.status-rejected { background: rgba(237, 28, 36, 0.15); color: #f87171; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding: 1rem 0;
}
.btn-text {
    background: none;
    border: none;
    color: var(--brand-blue);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}
.btn-text:hover { background: rgba(28, 117, 188, 0.1); }
.btn-text:disabled { color: var(--text-muted); cursor: not-allowed; background: none; }

.btn-outline {
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 0.375rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn-outline:hover { background: var(--glass-hover); border-color: var(--brand-blue); color: var(--brand-blue); }

.btn-secondary {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-light); }

/* Edit modal form */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(28, 117, 188, 0.2);
}

.form-group select option { background: #111827; color: var(--text-light); }

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

.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Delete icon */
.delete-icon { margin-bottom: 1rem; }

/* Term list */
.term-list { max-height: 200px; overflow-y: auto; }
.term-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.875rem;
}
.term-row:last-child { border-bottom: none; }
.term-status { color: var(--text-muted); font-size: 0.8rem; }

.term-list-full { }
.term-row-full {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.term-row-full:last-child { border-bottom: none; }

/* Glass card (intakes section) */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
}

/* ═══ ANIMATIONS ═══ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bgShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .hamburger {
        display: flex;
    }
    .main-content {
        margin-left: 0;
        padding-top: 4rem;
    }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .actions-bar { flex-direction: column; align-items: stretch; }
    .actions-left { flex-wrap: wrap; }
    .actions-right { width: 100%; }
    .actions-right .btn-secondary { width: 100%; }
    .analytics-grid { grid-template-columns: 1fr; }
    .group-cards-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .search-wrap { min-width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .main-content { padding: 1rem; padding-top: 4rem; }
    .modal-card { padding: 1.5rem; }
}
