/* assets/css/style.css */
/* Core Styling & Game Theme for Blok M Square Adventure */

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

:root {
    --primary: #2a35df;
    --primary-glow: rgba(42, 53, 223, 0.4);
    --secondary: #ffffff;
    --accent: #ffd54a;
    --accent-glow: rgba(255, 213, 74, 0.4);
    --dark: #0f172a;
    --dark-bg: #0b0f19;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --neon-blue: #00d2ff;
    --neon-pink: #ff007f;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6, .game-font {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* App Wrapper for Mobile First */
.app-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: #0b0f19;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    padding-bottom: 80px; /* Safe space for bottom nav */
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--dark-bg);
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 3px;
}

/* Header Navbar */
.game-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffd54a, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-badge.points {
    background: linear-gradient(135deg, rgba(42, 53, 223, 0.2), rgba(0, 210, 255, 0.2));
    border-color: rgba(42, 53, 223, 0.4);
    color: var(--neon-blue);
}

.header-badge.streak {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(249, 115, 22, 0.15));
    border-color: rgba(249, 115, 22, 0.3);
    color: #f97316;
}

/* Glassmorphism Game Card */
.game-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(8px);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.03), transparent);
    transform: rotate(45deg);
    transition: var(--transition);
    pointer-events: none;
}

.game-card:hover::before {
    left: 100%;
    transition: 1.2s;
}

/* Buttons */
.btn-play {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    padding: 15px 25px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: var(--transition);
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(42, 53, 223, 0.6);
}

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

.btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 25px;
    border: 2px solid #334155;
    border-radius: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: rgba(42, 53, 223, 0.1);
    transform: translateY(-1px);
}

.btn-accent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: linear-gradient(135deg, var(--accent), #eab308);
    color: var(--dark);
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    padding: 14px 20px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: var(--transition);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 213, 74, 0.6);
}

.btn-danger-game {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-danger-game:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 var(--primary-glow); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(42, 53, 223, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(42, 53, 223, 0); }
}

@keyframes pulse-accent {
    0% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-glow); }
    70% { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(255, 213, 74, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 213, 74, 0); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

@keyframes spin-slow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pulse-button {
    animation: pulse 2s infinite;
}

.pulse-accent-button {
    animation: pulse-accent 2s infinite;
}

.float-img {
    animation: float 4s ease-in-out infinite;
}

/* Interactive Map Styles */
.map-canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1; /* Square map */
    background: #0f172a;
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 10px;
    overflow: hidden;
}

.svg-map {
    width: 100%;
    height: 100%;
}

.map-node {
    cursor: pointer;
    transition: var(--transition);
}

.map-node circle {
    stroke-width: 3;
    transition: var(--transition);
}

.map-node:hover circle {
    stroke-width: 5;
    r: 14;
}

.map-node.active circle {
    animation: mapPulse 2s infinite;
}

@keyframes mapPulse {
    0% { stroke-width: 2; stroke-opacity: 1; }
    50% { stroke-width: 8; stroke-opacity: 0.5; }
    100% { stroke-width: 2; stroke-opacity: 1; }
}

.map-connection {
    stroke-dasharray: 6;
    animation: dash 15s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -100;
    }
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-left: 5px solid var(--primary);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

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

.toast.success { border-color: var(--success); }
.toast.warning { border-color: var(--warning); }
.toast.danger { border-color: var(--danger); }

/* Bottom Modal Sheets */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: 500px;
    background: #0f172a;
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    border-top: 1px solid var(--card-border);
    padding: 24px;
    z-index: 501;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.modal-sheet.show {
    transform: translate(-50%, 0);
}

.modal-drag-bar {
    width: 40px;
    height: 5px;
    background: #334155;
    border-radius: 99px;
    margin: 0 auto 20px;
}

/* Avatar grid style */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.avatar-option {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid #334155;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.avatar-option:hover {
    border-color: var(--primary);
    background: rgba(42, 53, 223, 0.1);
}

.avatar-option.selected {
    border-color: var(--accent);
    background: rgba(255, 213, 74, 0.15);
    transform: scale(1.08);
    box-shadow: 0 0 15px rgba(255, 213, 74, 0.3);
}

/* Form elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid #334155;
    color: white;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255,255,255,0.05);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Grid elements */
.game-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

/* Mission List Specific Styling */
.mission-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 12px 15px;
    cursor: pointer;
    transition: var(--transition);
}

.mission-card:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(42, 53, 223, 0.4);
    transform: scale(1.02);
}

.mission-badge {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.mission-info {
    flex-grow: 1;
}

.mission-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.mission-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mission-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.mission-points {
    color: var(--accent);
    font-weight: 700;
}

.status-indicator {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-indicator.available {
    background: rgba(255, 213, 74, 0.1);
    color: var(--accent);
    border: 1px solid rgba(255, 213, 74, 0.2);
}

.status-indicator.completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-indicator.locked {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Trivia question buttons */
.trivia-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.trivia-btn {
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #334155;
    color: white;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.trivia-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.trivia-btn.selected {
    background: rgba(42, 53, 223, 0.15);
    border-color: var(--primary);
}

.trivia-letter {
    width: 25px;
    height: 25px;
    background: #1e293b;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.trivia-btn.selected .trivia-letter {
    background: var(--primary);
    color: white;
}

/* Leaderboard Page */
.leaderboard-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}

.leaderboard-tab {
    flex: 1;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.leaderboard-tab.active {
    background: var(--primary);
    color: white;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 10px 15px;
}

.leaderboard-item.highlight {
    background: linear-gradient(135deg, rgba(42, 53, 223, 0.1), rgba(0, 210, 255, 0.05));
    border-color: rgba(42, 53, 223, 0.3);
}

.rank-badge {
    width: 30px;
    font-size: 1.1rem;
    font-weight: 800;
    text-align: center;
}

.rank-avatar {
    font-size: 1.8rem;
    width: 45px;
    height: 45px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-info {
    flex-grow: 1;
}

.rank-name {
    font-size: 0.95rem;
    font-weight: 700;
}

.rank-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.rank-score {
    text-align: right;
    font-weight: 800;
    color: var(--accent);
}

/* History logs list */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.history-item:last-child {
    border-bottom: none;
}
.history-desc {
    font-weight: 600;
    font-size: 0.9rem;
}
.history-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.history-val {
    font-weight: 800;
    font-size: 0.95rem;
}
.history-val.plus { color: var(--success); }
.history-val.minus { color: var(--danger); }
