/* =====================================================
   SQLQuest – Dashboard
   ===================================================== */

.dashboard-page {
    min-height: 100vh;
    background: var(--bg);
}

/* ---- Header Stats ---- */
.header-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.stat-item .stat-val {
    color: var(--text);
    font-size: 1.05rem;
}

.stat-item .stat-icon {
    font-size: 1.2rem;
}

/* ---- Hero ---- */
.dashboard-hero {
    background: linear-gradient(135deg, #0f1f3d 0%, #142244 100%);
    border-bottom: 2px solid var(--border);
    padding: 32px 20px;
}

.hero-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

.hero-text h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 8px;
}

.hero-text h1 span {
    color: var(--orange);
}

.hero-text p {
    color: var(--text-muted);
    max-width: 500px;
}

.hero-progress {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.progress-bar-track {
    height: 12px;
    background: var(--bg-2);
    border-radius: 99px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--orange), #ffcc02);
    border-radius: 99px;
    transition: width 0.8s ease;
}

/* ---- Content ---- */
.dashboard-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px;
}

/* ---- Section Levels ---- */
.level-section {
    margin-bottom: 40px;
}

.level-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.level-header h2 {
    font-size: 1.2rem;
}

.level-divider {
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ---- Module Grid ---- */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* ---- Module Card ---- */
.module-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--module-color, var(--orange));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}

.module-card:hover {
    border-color: var(--border-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.module-card:hover::before {
    transform: scaleX(1);
}

.module-card.done {
    border-color: rgba(67, 160, 71, 0.5);
}

.module-card.done::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    background: var(--green);
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

.module-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.module-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: block;
}

.module-funcao {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.module-desc {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.module-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
}

.module-xp {
    color: var(--orange);
    font-weight: 700;
}

/* ---- Lives display ---- */
.lives-display {
    display: flex;
    gap: 4px;
}

.life-icon {
    font-size: 1rem;
}

/* ---- SQL Keyword Badge ---- */
.sql-keyword {
    display: inline-block;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--orange);
    font-size: 0.9em;
}

/* ---- No Lives Modal ---- */
.nolives-modal {
    display: none;
}

.nolives-modal.active {
    display: flex;
}

.timer-display {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--orange);
    font-family: var(--font-mono);
    margin: 16px 0;
}

@media (max-width: 640px) {
    .modules-grid {
        grid-template-columns: 1fr 1fr;
    }

    .header-stats {
        display: none;
    }

    .hero-progress {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 400px) {
    .modules-grid {
        grid-template-columns: 1fr;
    }
}