/* Eso Desh Gari - Quiz Web Application
   Complete Modern Design System */

/* ===== CSS VARIABLES ===== */
:root {
    /* Brand Colors */
    --primary: #DC2626;
    --primary-dark: #B91C1C;
    --primary-light: #FEF2F2;
    --primary-hover: #EF4444;
    --primary-glow: rgba(220, 38, 38, 0.4);

    /* Accent Colors for Visual Variety */
    --accent-purple: #8B5CF6;
    --accent-purple-light: #EDE9FE;
    --accent-blue: #3B82F6;
    --accent-blue-light: #DBEAFE;
    --accent-teal: #14B8A6;
    --accent-teal-light: #CCFBF1;
    --accent-orange: #F97316;
    --accent-orange-light: #FFEDD5;
    --accent-pink: #EC4899;
    --accent-pink-light: #FCE7F3;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #DC2626 0%, #EF4444 50%, #F87171 100%);
    --gradient-purple: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 50%, #C4B5FD 100%);
    --gradient-blue: linear-gradient(135deg, #3B82F6 0%, #60A5FA 50%, #93C5FD 100%);
    --gradient-teal: linear-gradient(135deg, #14B8A6 0%, #2DD4BF 50%, #5EEAD4 100%);
    --gradient-orange: linear-gradient(135deg, #F97316 0%, #FB923C 50%, #FDBA74 100%);
    --gradient-sunset: linear-gradient(135deg, #F97316 0%, #EC4899 100%);
    --gradient-ocean: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
    --gradient-forest: linear-gradient(135deg, #10B981 0%, #14B8A6 100%);
    --gradient-dark: linear-gradient(135deg, #1E293B 0%, #334155 100%);

    /* Neutrals */
    --white: #FFFFFF;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    --bg: var(--gray-50);
    --surface: var(--white);
    --border: var(--gray-200);
    --text: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-muted: var(--gray-500);

    /* State */
    --success: #10B981;
    --success-light: #ECFDF5;
    --warning: #F59E0B;
    --warning-light: #FFFBEB;
    --error: #EF4444;
    --error-light: #FEF2F2;
    --info: #3B82F6;
    --info-light: #EFF6FF;

    /* Enhanced Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 20px rgba(220, 38, 38, 0.15);
    --shadow-card-hover: 0 20px 40px -15px rgba(0, 0, 0, 0.15), 0 10px 20px -10px rgba(0, 0, 0, 0.1);
    --shadow-colored: 0 10px 30px -10px;

    /* Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --header-height: 56px;
    --sidebar-width: 220px;
    --container-max: 1400px;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary);
}

img,
svg {
    display: block;
    max-width: 100%;
}

ul,
ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input,
textarea,
select {
    font-family: inherit;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

h1 {
    font-size: 1.5rem;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

h5 {
    font-size: 1rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-error {
    color: var(--error) !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

.text-left {
    text-align: left !important;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* ===== UTILITIES - DISPLAY ===== */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-inline {
    display: inline !important;
}

.d-inline-block {
    display: inline-block !important;
}

.d-flex {
    display: flex !important;
}

.d-inline-flex {
    display: inline-flex !important;
}

.d-grid {
    display: grid !important;
}

/* ===== UTILITIES - FLEXBOX ===== */
.flex-row {
    flex-direction: row;
}

.flex-column {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-nowrap {
    flex-wrap: nowrap;
}

.flex-1 {
    flex: 1 1 0%;
}

.flex-auto {
    flex: 1 1 auto;
}

.flex-none {
    flex: none;
}

.flex-grow {
    flex-grow: 1;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.items-start {
    align-items: flex-start;
}

.items-center {
    align-items: center;
}

.items-end {
    align-items: flex-end;
}

.items-stretch {
    align-items: stretch;
}

.justify-start {
    justify-content: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.justify-around {
    justify-content: space-around;
}

.justify-evenly {
    justify-content: space-evenly;
}

.align-center {
    align-items: center;
}

/* ===== UTILITIES - GAP ===== */
.gap-0 {
    gap: 0;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-5 {
    gap: 1.25rem;
}

.gap-6 {
    gap: 1.5rem;
}

.gap-8 {
    gap: 2rem;
}

/* ===== UTILITIES - SPACING ===== */
.m-0 {
    margin: 0 !important;
}

.m-1 {
    margin: 0.25rem !important;
}

.m-2 {
    margin: 0.5rem !important;
}

.m-3 {
    margin: 0.75rem !important;
}

.m-4 {
    margin: 1rem !important;
}

.m-auto {
    margin: auto !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 0.25rem !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.mt-3 {
    margin-top: 0.75rem !important;
}

.mt-4 {
    margin-top: 1rem !important;
}

.mt-5 {
    margin-top: 1.25rem !important;
}

.mt-6 {
    margin-top: 1.5rem !important;
}

.mt-8 {
    margin-top: 2rem !important;
}

.mt-auto {
    margin-top: auto !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 0.25rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 0.75rem !important;
}

.mb-4 {
    margin-bottom: 1rem !important;
}

.mb-5 {
    margin-bottom: 1.25rem !important;
}

.mb-6 {
    margin-bottom: 1.5rem !important;
}

.mb-8 {
    margin-bottom: 2rem !important;
}

.ml-auto {
    margin-left: auto !important;
}

.mr-auto {
    margin-right: auto !important;
}

.p-0 {
    padding: 0 !important;
}

.p-1 {
    padding: 0.25rem !important;
}

.p-2 {
    padding: 0.5rem !important;
}

.p-3 {
    padding: 0.75rem !important;
}

.p-4 {
    padding: 1rem !important;
}

.p-5 {
    padding: 1.25rem !important;
}

.p-6 {
    padding: 1.5rem !important;
}

.p-8 {
    padding: 2rem !important;
}

.px-2 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

.px-3 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

.px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.px-6 {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.py-3 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

.py-4 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.py-6 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

/* ===== UTILITIES - WIDTH/HEIGHT ===== */
.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.min-h-screen {
    min-height: 100vh;
}

/* ===== UTILITIES - POSITION ===== */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.top-0 {
    top: 0;
}

.right-0 {
    right: 0;
}

.bottom-0 {
    bottom: 0;
}

.left-0 {
    left: 0;
}

/* ===== UTILITIES - OVERFLOW ===== */
.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

.overflow-x-auto {
    overflow-x: auto;
}

.overflow-y-auto {
    overflow-y: auto;
}

/* ===== UTILITIES - BORDER ===== */
.rounded {
    border-radius: var(--radius);
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.border {
    border: 1px solid var(--border);
}

.border-t {
    border-top: 1px solid var(--border);
}

.border-b {
    border-bottom: 1px solid var(--border);
}

.border-l {
    border-left: 1px solid var(--border);
}

.border-r {
    border-right: 1px solid var(--border);
}

/* ===== UTILITIES - SHADOWS ===== */
.shadow-xs {
    box-shadow: var(--shadow-xs);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.shadow-xl {
    box-shadow: var(--shadow-xl);
}

.shadow-none {
    box-shadow: none;
}

/* ===== UTILITIES - BACKGROUNDS ===== */
.bg-white {
    background-color: var(--white);
}

.bg-gray-50 {
    background-color: var(--gray-50);
}

.bg-gray-100 {
    background-color: var(--gray-100);
}

.bg-primary {
    background-color: var(--primary);
}

.bg-primary-light {
    background-color: var(--primary-light);
}

/* ===== TABLES ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    white-space: nowrap;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== LAYOUT - CONTAINER ===== */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== LAYOUT - GRID ===== */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-1 {
    grid-template-columns: 1fr;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ===== QUIZ CARDS (Admin) ===== */
.quiz-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
}

.quiz-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
}

.quiz-card-image {
    height: 100px;
    background: linear-gradient(135deg, var(--primary) 0%, #ff6b6b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 2.5rem;
    position: relative;
}

.quiz-card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.1), transparent);
}

.quiz-card-content {
    padding: 1.25rem 1.5rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.quiz-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    line-height: 1.4;
    color: #1f2937;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.quiz-card-content>p {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.quiz-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding: 0.75rem 0;
    border-top: 1px solid #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
}

.quiz-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: #f9fafb;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
}

.quiz-card-meta i {
    color: var(--primary);
    font-size: 0.7rem;
}

/* Quiz card action buttons */
.quiz-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1rem;
    margin-top: auto;
    border-top: 1px solid #f3f4f6;
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    text-decoration: none;
    border: 1px solid transparent;
}

.action-btn:hover {
    transform: translateY(-2px);
}

/* Stats button - Blue */
.action-stats {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.action-stats:hover {
    background: #3b82f6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Questions button - Purple */
.action-questions {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.action-questions:hover {
    background: #8b5cf6;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Edit button - Gray */
.action-edit {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.action-edit:hover {
    background: #6b7280;
    color: white;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

/* Publish button - Green */
.action-publish {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.action-publish:hover {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Unpublish button - Orange */
.action-unpublish {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.action-unpublish:hover {
    background: #f59e0b;
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Delete button - Red */
.action-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.action-delete:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ===== LEADERBOARD LIST ===== */
.leaderboard-list {
    padding: 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item:hover {
    background: var(--gray-50);
}

.leaderboard-item.is-you {
    background: rgba(220, 38, 38, 0.05);
}

.leaderboard-rank {
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.rank-number {
    font-weight: 700;
    font-size: 1rem;
    color: #6b7280;
}

.leaderboard-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.leaderboard-user .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.leaderboard-user .user-name {
    font-weight: 600;
    color: #1f2937;
}

.leaderboard-stats {
    text-align: right;
    flex-shrink: 0;
}

.leaderboard-stats .stat-main {
    font-size: 1.1rem;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.25rem;
}

.leaderboard-stats .stat-main strong {
    color: var(--primary);
}

.leaderboard-stats .stat-main span {
    font-size: 0.75rem;
    color: #9ca3af;
}

.leaderboard-stats .stat-secondary {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    justify-content: flex-end;
}

/* Hide on mobile */
@media (max-width: 640px) {
    .hide-mobile {
        display: none !important;
    }

    .leaderboard-item {
        gap: 0.75rem;
        padding: 0.875rem 1rem;
    }

    .leaderboard-rank {
        width: 32px;
    }

    .leaderboard-user .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }
}

/* Badge enhancements for cards */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning);
}

.badge-error {
    background-color: var(--error-light);
    color: var(--error);
}

.badge-info {
    background-color: var(--info-light);
    color: var(--info);
}


@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {

    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Results Page Fixes */
    .card-footer.d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }

    .card-footer .btn {
        width: 100%;
        justify-content: center;
        white-space: nowrap;
    }

    .container {
        padding: 0 1rem;
    }
}

/* ===== COMPONENTS - AVATAR ===== */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.125rem;
}

.avatar-xl {
    width: 72px;
    height: 72px;
    font-size: 1.5rem;
}

/* ===== COMPONENTS - BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--gray-50);
    color: var(--text);
    border-color: var(--gray-300);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--text);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* ===== COMPONENTS - CARDS ===== */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--white);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--gray-50);
}

/* ===== COMPONENTS - STAT CARDS ===== */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.stat-icon.error {
    background: var(--error-light);
    color: var(--error);
}

.stat-content {
    min-width: 0;
}

.stat-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.125rem;
}

.stat-content p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

/* ===== COMPONENTS - BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-error {
    background: var(--error-light);
    color: var(--error);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

/* ===== COMPONENTS - FORMS ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control,
.form-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-control::placeholder,
.form-input::placeholder {
    color: var(--gray-400);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

/* ===== COMPONENTS - TABLES ===== */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--gray-50);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* ===== COMPONENTS - PROGRESS ===== */
.progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* ===== PORTAL - HEADER ===== */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.portal-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.portal-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
}

.portal-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    font-size: 1rem;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.portal-nav a {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.portal-nav a:hover,
.portal-nav a.active {
    background: var(--gray-100);
    color: var(--text);
}

.portal-nav .btn-auth {
    margin-left: 0.5rem;
    background: var(--primary);
    color: white;
}

.portal-nav .btn-auth:hover {
    background: var(--primary-dark);
    color: white;
}

.mobile-menu-btn {
    display: none;
    padding: 0.5rem;
    font-size: 1.25rem;
    color: var(--text);
    background: none;
    border: none;
}

/* ===== PORTAL - LAYOUT ===== */
.portal-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 2rem;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - var(--header-height));
}

/* ===== PORTAL - SIDEBAR ===== */
.portal-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    height: fit-content;
    max-height: calc(100vh - var(--header-height) - 4rem);
    overflow-y: auto;
}

.sidebar-title {
    padding: 0 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.category-link:hover {
    background: var(--white);
    color: var(--text);
}

.category-link.active {
    background: var(--white);
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.category-count {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    background: var(--gray-100);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

/* ===== PORTAL - MAIN ===== */
.portal-main {
    min-width: 0;
}

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.admin-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* ===== PORTAL - SEARCH ===== */
.portal-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    transition: all var(--transition);
}

.portal-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.portal-search i {
    color: var(--text-muted);
    font-size: 1rem;
}

.portal-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9375rem;
    color: var(--text);
    background: transparent;
}

.portal-search input::placeholder {
    color: var(--gray-400);
}

/* ===== PORTAL - QUIZ GRID ===== */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Force horizontal row for small quiz lists */
.quiz-grid.horizontal {
    grid-template-columns: repeat(auto-fit, minmax(200px, 280px));
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.quiz-tile {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    transition: all var(--transition);
}

.quiz-tile:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quiz-tile-header {
    position: relative;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.quiz-tile-header i {
    font-size: 2rem;
    color: white;
    opacity: 0.9;
}

.quiz-tile-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.625rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text);
}

.quiz-tile-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}

.quiz-category-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    margin-bottom: 0.5rem;
    width: fit-content;
}

.quiz-tile-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.quiz-tile-meta {
    display: flex;
    gap: 1rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.quiz-tile-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}

.quiz-tile-action span {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
}

.action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-full);
    transition: all var(--transition);
}

.quiz-tile:hover .action-icon {
    background: var(--primary);
    color: white;
}

/* ===== ADMIN PANEL LAYOUT ===== */
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--gray-900);
    color: var(--gray-300);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 100;
    overflow-y: auto;
}

.admin-sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-700);
}

.admin-sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.admin-sidebar-header .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.admin-sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: var(--gray-400);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    transition: all var(--transition);
}

.admin-nav-item:hover {
    color: white;
    background: var(--gray-800);
}

.admin-nav-item.active {
    color: white;
    background: var(--primary);
}

.admin-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9375rem;
}

.admin-main {
    grid-column: 2;
    padding: 1.5rem;
    background: var(--bg);
    min-height: 100vh;
    margin-left: 240px;
}

.sidebar-toggle {
    display: none;
}

/* Admin responsive */
@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        grid-column: 1;
        margin-left: 0;
        padding: 1rem;
    }

    .sidebar-toggle {
        display: inline-flex;
    }
}

/* ===== CATEGORY SECTION ===== */
.category-section {
    margin-bottom: 2.5rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.category-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.125rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ===== FOOTER ===== */
.portal-footer {
    padding: 1.5rem 2rem;
    background: var(--white);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-content {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-content p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

@media (max-width: 640px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Mobile Elements - Hidden by default on desktop */
.mobile-nav {
    display: none;
}

.mobile-menu-btn {
    display: none;
}

/* ===== RESPONSIVE ===== */

/* Tablet and below */
@media (max-width: 1024px) {
    .portal-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .portal-sidebar {
        display: none;
    }

    .container {
        padding: 0 1rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    /* Header */
    .portal-header-inner {
        padding: 0 1rem;
    }

    .portal-logo .logo-text {
        display: none;
    }

    .desktop-nav {
        display: none !important;
    }

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: transparent;
        border: none;
        color: var(--text);
        font-size: 1.25rem;
        cursor: pointer;
        border-radius: var(--radius);
        transition: background var(--transition);
    }

    .mobile-menu-btn:hover {
        background: var(--gray-100);
    }

    /* Mobile Navigation Menu */
    .mobile-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        padding: 0.5rem;
        z-index: 99;
    }

    .mobile-nav.active {
        display: block;
    }

    .mobile-nav a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.875rem 1rem;
        color: var(--text);
        font-size: 1rem;
        font-weight: 500;
        border-radius: var(--radius);
        transition: background var(--transition);
    }

    .mobile-nav a:hover {
        background: var(--gray-50);
    }

    .mobile-nav a i {
        width: 20px;
        text-align: center;
        color: var(--text-muted);
    }

    .mobile-nav .mobile-login,
    .mobile-nav .mobile-logout {
        background: var(--primary);
        color: white;
        margin-top: 0.5rem;
    }

    .mobile-nav .mobile-login:hover,
    .mobile-nav .mobile-logout:hover {
        background: var(--primary-dark);
    }

    .mobile-nav .mobile-login i,
    .mobile-nav .mobile-logout i {
        color: white;
    }

    /* Typography */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    /* Layout */
    .portal-layout {
        padding: 1rem;
    }

    .admin-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .admin-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Cards */
    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .stat-content h3 {
        font-size: 1.25rem;
    }

    .card-header,
    .card-body {
        padding: 1rem;
    }

    /* Quiz Grid */
    .quiz-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .quiz-tile-header {
        height: 100px;
    }

    .quiz-tile-body {
        padding: 1rem;
    }

    /* Tables */
    .table th,
    .table td {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }

    /* Search */
    .portal-search {
        margin-bottom: 1rem;
    }

    /* Footer */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .footer-links {
        justify-content: center;
    }
}

/* Small Mobile */
@media (max-width: 480px) {

    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .portal-layout {
        padding: 0.75rem;
    }

    .stat-card {
        padding: 0.875rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .stat-content h3 {
        font-size: 1.125rem;
    }

    .stat-content p {
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .btn-lg {
        padding: 0.75rem 1.25rem;
    }

    /* Auth pages */
    .auth-page {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .auth-title {
        font-size: 1.25rem;
    }

    /* Tables - horizontal scroll */
    .table-wrapper {
        margin: 0 -0.75rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

@media (max-width: 480px) {

    .grid-4,
    .grid-3,
    .grid-2 {
        gap: 1rem;
    }

    .card-header,
    .card-body {
        padding: 1rem;
    }

    .quiz-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== AUTH PAGES (Login/Register) ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
}

.auth-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}

.auth-logo .logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--primary);
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
}

.auth-card .form-group {
    margin-bottom: 1.25rem;
}

.auth-card .form-control {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.auth-card .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Form Check */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-check-input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.alert-error {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }

    .auth-title {
        font-size: 1.25rem;
    }
}

/* ===== ENHANCED VISUAL STYLES ===== */

/* Keyframe Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(220, 38, 38, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.5);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Enhanced Body Background */
body {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-attachment: fixed;
}

/* Enhanced Header with Glassmorphism */
.portal-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 20px rgba(0, 0, 0, 0.03);
}

.portal-logo {
    transition: transform var(--transition);
}

.portal-logo:hover {
    transform: scale(1.02);
}

.portal-logo-icon {
    background: var(--gradient-primary);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    transition: all var(--transition);
}

.portal-logo:hover .portal-logo-icon {
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
    transform: rotate(-5deg);
}

/* Enhanced Navigation */
.portal-nav a {
    position: relative;
    overflow: hidden;
}

.portal-nav a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: all var(--transition);
    transform: translateX(-50%);
}

.portal-nav a:hover::before,
.portal-nav a.active::before {
    width: 80%;
}

.portal-nav a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.portal-nav a.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}

.portal-nav .btn-auth {
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    transition: all var(--transition);
}

.portal-nav .btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

/* Enhanced Sidebar */
.portal-sidebar {
    animation: fadeIn 0.3s ease;
}

.sidebar-title {
    position: relative;
    padding-left: 12px;
}

.sidebar-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.category-link {
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.category-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform var(--transition);
}

.category-link:hover::before,
.category-link.active::before {
    transform: scaleY(1);
}

.category-link:hover {
    background: var(--white);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.category-link.active {
    background: var(--white);
    border-left: none;
}

.category-icon {
    transition: all var(--transition);
}

.category-link:hover .category-icon {
    transform: scale(1.1);
}

.category-count {
    transition: all var(--transition);
}

.category-link:hover .category-count {
    background: var(--primary-light);
    color: var(--primary);
}

/* Enhanced Search Box */
.portal-search {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.portal-search:focus-within {
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(220, 38, 38, 0.1);
    transform: translateY(-1px);
}

.portal-search i {
    transition: color var(--transition);
}

.portal-search:focus-within i {
    color: var(--primary);
}

/* Enhanced Quiz Cards */
.quiz-grid {
    animation: fadeInUp 0.4s ease;
}

.quiz-tile {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-slow);
    border: 1px solid transparent;
    background: var(--white);
    animation: fadeInUp 0.4s ease backwards;
}

.quiz-tile:nth-child(1) {
    animation-delay: 0.05s;
}

.quiz-tile:nth-child(2) {
    animation-delay: 0.1s;
}

.quiz-tile:nth-child(3) {
    animation-delay: 0.15s;
}

.quiz-tile:nth-child(4) {
    animation-delay: 0.2s;
}

.quiz-tile:nth-child(5) {
    animation-delay: 0.25s;
}

.quiz-tile:nth-child(6) {
    animation-delay: 0.3s;
}

.quiz-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
    z-index: 1;
}

.quiz-tile:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--gray-200);
}

.quiz-tile:hover::before {
    opacity: 1;
}

.quiz-tile-header {
    position: relative;
    overflow: hidden;
    height: 100px;
}

.quiz-tile-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.6s ease;
}

.quiz-tile:hover .quiz-tile-header::before {
    transform: rotate(45deg) translateX(100%);
}

.quiz-tile-header i {
    font-size: 2.5rem;
    transition: all var(--transition);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.quiz-tile:hover .quiz-tile-header i {
    transform: scale(1.15) rotate(-5deg);
}

.quiz-tile-badge {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all var(--transition);
}

.quiz-tile:hover .quiz-tile-badge {
    transform: scale(1.05);
}

.quiz-category-badge {
    font-weight: 700;
    letter-spacing: 0.08em;
    transition: all var(--transition);
}

.quiz-tile:hover .quiz-category-badge {
    transform: translateX(3px);
}

.quiz-tile-title {
    transition: color var(--transition);
}

.quiz-tile:hover .quiz-tile-title {
    color: var(--primary);
}

.quiz-tile-action {
    position: relative;
}

.action-icon {
    width: 32px;
    height: 32px;
    transition: all var(--transition-bounce);
}

.quiz-tile:hover .action-icon {
    background: var(--gradient-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
}

/* Enhanced Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    animation: fadeInUp 0.4s ease backwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.25s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    transform: scaleY(1);
}

.stat-icon {
    position: relative;
    transition: all var(--transition);
}

.stat-icon::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: inherit;
    opacity: 0.3;
    filter: blur(8px);
    z-index: -1;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary-light) 0%, #fecaca 100%);
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--success-light) 0%, #a7f3d0 100%);
}

.stat-icon.warning {
    background: linear-gradient(135deg, var(--warning-light) 0%, #fde68a 100%);
}

.stat-icon.info {
    background: linear-gradient(135deg, var(--info-light) 0%, #bfdbfe 100%);
}

.stat-content h3 {
    background: linear-gradient(135deg, var(--text) 0%, var(--gray-700) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced Cards */
.card {
    transition: all var(--transition);
    animation: fadeInUp 0.4s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
}

.card-header h3 i {
    color: var(--primary);
}

/* Enhanced Buttons */
.btn {
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline {
    position: relative;
    z-index: 1;
}

.btn-outline::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-light);
    border-radius: inherit;
    z-index: -1;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition);
}

.btn-outline:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Enhanced Badges */
.badge {
    transition: all var(--transition);
}

.badge-primary {
    background: linear-gradient(135deg, var(--primary-light) 0%, #fecaca 100%);
}

.badge-success {
    background: linear-gradient(135deg, var(--success-light) 0%, #a7f3d0 100%);
}

.badge-warning {
    background: linear-gradient(135deg, var(--warning-light) 0%, #fde68a 100%);
}

.badge-error {
    background: linear-gradient(135deg, var(--error-light) 0%, #fecaca 100%);
}

.badge-info {
    background: linear-gradient(135deg, var(--info-light) 0%, #bfdbfe 100%);
}

/* Enhanced Tables */
.table tbody tr {
    transition: all var(--transition);
}

.table tbody tr:hover {
    background: linear-gradient(90deg, var(--gray-50) 0%, var(--white) 100%);
    transform: scale(1.005);
}

/* Enhanced Avatar */
.avatar {
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.avatar:hover {
    transform: scale(1.05);
}

/* Leaderboard Enhancements */
.grid-3 .card {
    transition: all var(--transition);
}

.grid-3 .card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.grid-3 .card .fa-medal {
    animation: pulse 2s infinite;
}

.grid-3 .card:hover .fa-medal {
    animation: bounceIn 0.5s ease;
}

/* Results Page Enhancements */
.container .card {
    animation: scaleIn 0.4s ease;
}

/* Progress Bar Enhancement */
.progress {
    overflow: hidden;
    position: relative;
}

.progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
    background-size: 200% 100%;
}

.progress-bar {
    background: var(--gradient-primary);
    position: relative;
    z-index: 1;
}

/* Form Enhancements */
.form-control:focus,
.form-input:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1), var(--shadow-sm);
    transform: translateY(-1px);
}

/* Alert Enhancements */
.alert {
    animation: slideInLeft 0.3s ease;
}

.alert-success {
    border-left: 4px solid var(--success);
}

.alert-error {
    border-left: 4px solid var(--error);
}

/* Empty State Enhancement */
.empty-state {
    animation: fadeIn 0.5s ease;
}

.empty-state i {
    animation: float 3s ease-in-out infinite;
}

/* Mobile Menu Enhancement */
.mobile-nav {
    animation: fadeInUp 0.3s ease;
}

.mobile-nav a {
    animation: slideInLeft 0.3s ease backwards;
}

.mobile-nav a:nth-child(1) {
    animation-delay: 0.05s;
}

.mobile-nav a:nth-child(2) {
    animation-delay: 0.1s;
}

.mobile-nav a:nth-child(3) {
    animation-delay: 0.15s;
}

.mobile-nav a:nth-child(4) {
    animation-delay: 0.2s;
}

.mobile-nav a:nth-child(5) {
    animation-delay: 0.25s;
}

/* Auth Page Enhancements */
.auth-page {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    position: relative;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(220, 38, 38, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.auth-card {
    animation: scaleIn 0.4s ease;
    box-shadow: var(--shadow-xl), 0 0 40px rgba(0, 0, 0, 0.05);
}

.auth-logo .logo-icon {
    background: var(--gradient-primary);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.3);
    animation: pulse 3s ease-in-out infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Page Load Animation */
.portal-layout,
.container {
    animation: fadeIn 0.3s ease;
}

/* Focus States for Accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print Styles - keep design clean */
@media print {

    .portal-header,
    .portal-sidebar,
    .portal-footer,
    .btn {
        display: none !important;
    }

    body {
        background: white !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ===== ADMIN LAYOUT ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transition: transform var(--transition);
}

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-width: 0;
    /* Prevent overflow issues */
    transition: margin-left var(--transition);
}

/* Sidebar Header */
.admin-sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
    font-weight: 700;
    font-size: 1.125rem;
}

/* Sidebar Navigation */
.admin-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-400);
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.admin-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.admin-nav-item.active {
    background: rgba(220, 38, 38, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.admin-nav-item i {
    width: 1.25rem;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        padding: 1.5rem;
    }
}

/* ===== CATEGORY CARDS ===== */
.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--primary-glow);
}

.category-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.category-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    position: relative;
}

.category-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: currentColor;
    opacity: 0.1;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.category-count {
    color: var(--text-muted);
    font-size: 0.875rem;
    background: var(--gray-100);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    margin-top: 0.5rem;
}

.category-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-actions {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    background: var(--gray-50);
}

.category-actions .btn {
    flex: 1;
    justify-content: center;
}

/* Modal enhancements */
.modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal {
    background: var(--white);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border);
    transform: scale(0.95);
    transition: all var(--transition-bounce);
}

/* Modal active state */
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-close {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    transition: color var(--transition);
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    background: var(--gray-50);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}