/* assets/style.css - Gamified Mathematics Platform Styles */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&display=swap');

:root, [data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-solid: #ffffff;
    --accent-primary: #8b5cf6;
    --accent-secondary: #06b6d4;
    --text-main: #0f172a;
    --text-muted: #475569;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(139, 92, 246, 0.5);
    --glow-primary: 0 4px 12px rgba(139, 92, 246, 0.12);
    --glow-secondary: 0 4px 12px rgba(6, 182, 212, 0.12);
}

[data-theme="dark"] {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.75);
    --bg-card-solid: #1e293b;
    --accent-primary: #8b5cf6;
    --accent-secondary: #06b6d4;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(139, 92, 246, 0.6);
    --glow-primary: 0 0 20px rgba(139, 92, 246, 0.4);
    --glow-secondary: 0 0 20px rgba(6, 182, 212, 0.4);
}

[data-theme="sepia"] {
    --bg-dark: #f4ecd8;
    --bg-card: rgba(253, 251, 241, 0.85);
    --bg-card-solid: #fdfbf1;
    --accent-primary: #9a3412;
    --accent-secondary: #b45309;
    --text-main: #433422;
    --text-muted: #7c6a59;
    --success: #15803d;
    --warning: #d97706;
    --danger: #b91c1c;
    --border-color: rgba(67, 52, 34, 0.12);
    --border-hover: rgba(154, 52, 18, 0.5);
    --glow-primary: 0 4px 12px rgba(154, 52, 18, 0.12);
    --glow-secondary: 0 4px 12px rgba(180, 83, 9, 0.12);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    
    /* Math Grid Background overlaying a subtle radial glow */
    background-image: 
        linear-gradient(var(--border-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-color) 1px, transparent 1px),
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 40%);
    background-size: 30px 30px, 30px 30px, 100% 100%, 100% 100%;
    background-position: center center;
    background-attachment: fixed;
    
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Hide header stats on small mobile screen */
@media (max-width: 768px) {
    .user-stats .header-stat-pill {
        display: none !important;
    }
}

.stat-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.stat-pill.xp {
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--accent-secondary);
}

.stat-pill.stars {
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

/* Hamburger & Navigation Drawer System */
.hamburger-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    z-index: 1100;
    padding: 0;
}

.hamburger-btn span {
    width: 100%;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 9999px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Side Drawer */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    z-index: 1050;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.drawer-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

.drawer-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    font-weight: bold;
}

.drawer-close:hover {
    color: var(--text-main);
}

.drawer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.drawer-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}


/* General Layout Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
    flex: 1;
}

/* Buttons */
.btn {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
    color: var(--text-main);
    box-shadow: var(--glow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* Auth Cards */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 1rem;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.auth-card h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--text-main);
}

.auth-card p.subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

/* Map Path (Duolingo Style) */
.map-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 0;
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.map-svg-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.map-node-wrapper {
    position: relative;
    margin: 2.5rem 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Offsets for wavy effect */
.map-node-wrapper:nth-child(even) {
    transform: translateX(60px);
}
.map-node-wrapper:nth-child(odd) {
    transform: translateX(-60px);
}

.map-node {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 4px solid var(--border-color);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.map-node.locked {
    background: #334155;
    color: var(--text-muted);
    cursor: not-allowed;
}

.map-node.available {
    background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
    color: white;
    border-color: #a78bfa;
    box-shadow: var(--glow-primary);
    animation: pulseGlow 2s infinite alternate;
}

.map-node.completed {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.map-node:hover:not(.locked) {
    transform: scale(1.1) translateY(-5px);
}

.map-node-tooltip {
    position: absolute;
    bottom: -35px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    font-weight: 600;
}

.map-node-stars {
    position: absolute;
    top: -20px;
    display: flex;
    gap: 2px;
}

.map-node-stars span {
    color: var(--text-muted);
    font-size: 1rem;
}

.map-node-stars span.earned {
    color: var(--warning);
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
    }
    100% {
        box-shadow: 0 0 25px rgba(139, 92, 246, 0.8);
    }
}

/* Activity UI */
.activity-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.activity-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Number Line Component */
.number-line-container {
    margin: 3.5rem 0;
    position: relative;
    padding: 2rem 0;
    user-select: none;
}

.number-line-track {
    height: 4px;
    background: var(--accent-secondary);
    position: relative;
    box-shadow: var(--glow-secondary);
}

.number-line-arrows {
    position: absolute;
    width: 100%;
    top: -8px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.number-line-arrows::before,
.number-line-arrows::after {
    content: '';
    width: 20px;
    height: 20px;
    border-top: 4px solid var(--accent-secondary);
    border-right: 4px solid var(--accent-secondary);
}

.number-line-arrows::before {
    transform: rotate(-135deg);
    margin-left: -5px;
}

.number-line-arrows::after {
    transform: rotate(45deg);
    margin-right: -5px;
}

/* Division marks on number line */
.number-line-mark {
    position: absolute;
    top: -12px;
    width: 2px;
    height: 28px;
    background: var(--border-color);
    transform: translateX(-50%);
}

.number-line-mark.main {
    height: 36px;
    top: -16px;
    background: var(--accent-secondary);
    width: 3px;
}

.mark-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Slots where fractions can be placed */
.number-line-slot {
    position: absolute;
    top: -24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px dashed rgba(6, 182, 212, 0.4);
    background: rgba(15, 23, 42, 0.8);
    transform: translateX(-50%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.number-line-slot:hover {
    border-color: var(--accent-secondary);
    transform: translateX(-50%) scale(1.15);
    background: rgba(6, 182, 212, 0.1);
}

.number-line-slot.filled {
    border-style: solid;
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    box-shadow: var(--glow-primary);
    color: white;
    font-weight: bold;
}

/* Draggable / Pickable Fraction Cards */
.fraction-pool {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 2.5rem 0;
}

.fraction-card {
    background: var(--bg-card-solid);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    min-width: 65px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.fraction-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-secondary);
    box-shadow: var(--glow-secondary);
}

.fraction-card.selected {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.2);
    box-shadow: var(--glow-primary);
}

.fraction-card:active {
    cursor: grabbing;
}

.fraction-card.placed {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Math Fraction Display */
.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    line-height: 1.1;
}
.fraction .num {
    border-bottom: 2px solid currentColor;
    padding: 0 2px;
    text-align: center;
}
.fraction .den {
    text-align: center;
    padding: 0 2px;
}

/* Modal Popup & Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 550px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.modal-body {
    margin-bottom: 2rem;
    line-height: 1.6;
    color: var(--text-muted);
    overflow-y: auto;
    padding-right: 0.5rem;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
}

/* Admin Dashboard Table */
.admin-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.admin-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-admin {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-student {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-secondary);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Responsive Rules */
@media (max-width: 768px) {
    header {
        padding: 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .map-node-wrapper:nth-child(even),
    .map-node-wrapper:nth-child(odd) {
        transform: translateX(0); /* straighten path on mobile */
    }

    .activity-card {
        padding: 1.5rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .admin-header-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Level 2 Fraction Wall */
.fraction-wall-container {
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.wall-row {
    display: flex;
    width: 100%;
    height: 40px;
    border-bottom: 1px solid var(--border-color);
}

.wall-row:last-child {
    border-bottom: none;
}

.wall-block {
    flex: 1;
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.wall-block:last-child {
    border-right: none;
}

.wall-block:hover {
    filter: brightness(1.15);
}

.wall-block.active {
    filter: brightness(1.3);
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.7);
    z-index: 2;
}

