/* ═══════════════════════════════════════════
   HisarPin Admin Panel — Styles
   Premium dark theme with glassmorphism
   ═══════════════════════════════════════════ */

/* ─── Reset & Variables ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-hover: rgba(255, 255, 255, 0.06);

    --text-primary: #f1f5f9;
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-muted: rgba(255, 255, 255, 0.3);

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --sidebar-width: 240px;
    --topbar-height: 64px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ═══ LOGIN SCREEN ═══ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1040 50%, #0f172a 100%);
    position: relative;
}

.login-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

.login-card {
    position: relative;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    font-size: 3.5rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.login-card h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #f1f5f9, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 32px;
}

.input-group {
    text-align: left;
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: all 0.2s;
    outline: none;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input::placeholder { color: var(--text-muted); }

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.login-error {
    color: var(--danger);
    font-size: 0.82rem;
    margin-top: 12px;
    min-height: 20px;
}

/* ═══ APP LAYOUT ═══ */
.app {
    display: flex;
    min-height: 100vh;
}

.hidden { display: none !important; }

/* ═══ SIDEBAR ═══ */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo { font-size: 1.6rem; }

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #f1f5f9, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent-light);
}

.nav-icon { font-size: 1.1rem; }

.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
}

/* ═══ MAIN CONTENT ═══ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.btn-menu {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 6px 10px;
    cursor: pointer;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.clock {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ═══ PAGES ═══ */
.page {
    display: none;
    padding: 28px;
    animation: fadeIn 0.25s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══ STATS GRID ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.stat-total::before { background: var(--info); }
.stat-unlocked::before { background: var(--success); }
.stat-locked::before { background: var(--danger); }
.stat-offline::before { background: var(--text-muted); }

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-icon { font-size: 1.5rem; margin-bottom: 6px; }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 4px 0;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ═══ SECTION HEADER ═══ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.section-actions { display: flex; gap: 8px; }

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-glass);
    color: var(--text-primary);
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.btn-sm { padding: 7px 12px; font-size: 0.78rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 2px 12px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.12);
}

.btn-success {
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.12);
}

.btn-secondary {
    background: transparent;
}

.btn-refresh { color: var(--info); border-color: rgba(59, 130, 246, 0.3); }
.btn-refresh:hover { background: rgba(59, 130, 246, 0.1); }

/* ═══ BOARDS GRID ═══ */
.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.board-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.board-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.board-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    position: relative;
}

.board-status-dot.unlocked { background: var(--success); box-shadow: 0 0 8px var(--success); }
.board-status-dot.locked { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.board-status-dot.offline { background: #6b7280; }

.board-status-dot.unlocked::after, .board-status-dot.locked::after {
    content: '';
    position: absolute;
    top: -3px; left: -3px; right: -3px; bottom: -3px;
    border-radius: 50%;
    animation: pulse-ring 2s ease-in-out infinite;
}

.board-status-dot.unlocked::after { border: 2px solid var(--success); }
.board-status-dot.locked::after { border: 2px solid var(--danger); }

@keyframes pulse-ring {
    0%, 100% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

.board-name {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 4px;
}

.board-group {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.board-actions-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.board-actions-row .btn { padding: 5px 10px; font-size: 0.72rem; }

/* ═══ MODALS ═══ */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 440px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 { font-size: 1.05rem; font-weight: 700; }

.modal-close {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.15s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ═══ TOAST ═══ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 22px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    z-index: 300;
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

@keyframes toastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ═══ ANNOUNCEMENTS LIST ═══ */
.announcement-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.announcement-item h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.announcement-item p { font-size: 0.82rem; color: var(--text-secondary); }
.announcement-meta { font-size: 0.72rem; color: var(--text-muted); }

/* ═══ USERS / GROUPS LIST ═══ */
.user-item, .group-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s;
}

.user-item:hover, .group-item:hover {
    border-color: var(--border-hover);
}

.user-item-info, .group-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.user-name-role { display: flex; flex-direction: column; }
.user-name-role strong { font-size: 0.88rem; }
.user-name-role small { font-size: 0.72rem; color: var(--text-secondary); }

.role-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin { background: rgba(99, 102, 241, 0.15); color: var(--accent-light); }
.role-teacher { background: rgba(16, 185, 129, 0.15); color: var(--success); }

/* ═══ LOADING ═══ */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .btn-menu { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .boards-grid { grid-template-columns: 1fr; }
    .modal-content { width: 95vw; padding: 20px; }
}
