/*
 * GANITSUTRAM
 * A Living Knowledge Ecosystem for Mathematical Discovery
 *
 * "यथा शिखा मयूराणां नागानां मणयो यथा
 *  तद्वद् वेदाङ्गशास्त्राणां गणितं मूर्ध्नि वर्तते"
 *
 * As the crest of a peacock, as the gem on the hood
 * of a cobra — so stands mathematics at the crown
 * of all knowledge.
 *                                       — Brahmagupta
 *                                         628 CE · Brahmasphutasiddhanta
 *
 * Creator:   Jawahar R. Mallah
 * Email:     jawahar@aitdl.com
 * GitHub:    https://github.com/jawahar-mallah
 * Websites:  https://ganitsutram.com
 *            https://aitdl.com
 *
 * Then:  628 CE · Brahmasphutasiddhanta
 * Now:   8 March MMXXVI · Vikram Samvat 2082
 *
 * Copyright © 2026 Jawahar R. Mallah · AITDL | GANITSUTRAM
 *
 * Developer Note:
 * If you intend to reuse this code, please respect
 * the creator and the work behind it.
 */
/*
Project: GanitSūtram
Author: Jawahar R Mallah
Company: AITDL | aitdl.com

Date:
Vikram Samvat: VS 2082
Gregorian: 2026-03-07

Purpose: User Profile & Progress Dashboard styles.
         Premium dark theme with glassmorphism.
*/

:root {
    --profile-bg: #0a0a0f;
    --profile-card: rgba(255, 255, 255, 0.03);
    --profile-border: rgba(255, 255, 255, 0.07);
    --profile-accent: #ff5500;
    --profile-fg: #e8e8f0;
    --profile-fg-dim: rgba(232, 232, 240, 0.5);

    /* Roles */
    --role-student: #22c55e;
    --role-teacher: #0ea5e9;
    --role-parent: #ec4899;
    --role-adult: #a855f7;
    --role-school: #ffb300;
    --role-admin: #ff5500;
}

body.profile-body {
    background-color: var(--profile-bg);
    color: var(--profile-fg);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
}

.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 6rem;
}

/* --- HEADER SECTION --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    padding: 3rem;
    background: linear-gradient(135deg, rgba(255, 85, 0, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--profile-border);
    border-radius: 24px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.profile-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 85, 0, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.avatar-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--profile-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 30px rgba(255, 85, 0, 0.3);
    flex-shrink: 0;
}

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

.profile-email {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.profile-badges-inline {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.role-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid currentColor;
}

.role-student {
    color: var(--role-student);
    background: rgba(34, 197, 94, 0.1);
}

.role-teacher {
    color: var(--role-teacher);
    background: rgba(14, 165, 233, 0.1);
}

.role-parent {
    color: var(--role-parent);
    background: rgba(236, 72, 153, 0.1);
}

.role-adult {
    color: var(--role-adult);
    background: rgba(168, 85, 247, 0.1);
}

.role-school {
    color: var(--role-school);
    background: rgba(255, 179, 0, 0.1);
}

.role-admin {
    color: var(--role-admin);
    background: rgba(255, 85, 0, 0.1);
}

.member-since {
    font-size: 0.85rem;
    color: var(--profile-fg-dim);
    margin-bottom: 0.75rem;
}

.profile-meta-btns {
    display: flex;
    gap: 0.75rem;
}

.gs-profile-mini-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--profile-border);
    color: var(--profile-fg-dim);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.gs-profile-mini-btn:hover {
    background: rgba(255, 85, 0, 0.1);
    border-color: var(--profile-accent);
    color: var(--profile-fg);
}

.profile-actions {
    display: flex;
    gap: 1rem;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--profile-border);
    color: var(--profile-fg);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

/* --- ACHIEVEMENT BADGES --- */
.section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 2rem 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.badges-row {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: none;
}

.badges-row::-webkit-scrollbar {
    display: none;
}

.badge-item {
    min-width: 140px;
    max-width: 140px;
    background: var(--profile-card);
    border: 1px solid var(--profile-border);
    padding: 1.5rem 1rem;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.badge-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    filter: grayscale(100%);
    opacity: 0.4;
}

.badge-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--profile-fg-dim);
}

.badge-desc {
    font-size: 0.7rem;
    color: rgba(232, 232, 240, 0.3);
    line-height: 1.3;
}

.badge-item.earned {
    background: rgba(255, 85, 0, 0.05);
    border-color: rgba(255, 85, 0, 0.3);
}

.badge-item.earned .badge-icon {
    filter: none;
    opacity: 1;
    text-shadow: 0 0 20px rgba(255, 85, 0, 0.5);
}

.badge-item.earned .badge-title {
    color: var(--profile-fg);
}

.badge-item.earned .badge-desc {
    color: var(--profile-fg-dim);
}

.badge-lock {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.8rem;
    opacity: 0.5;
}

.badge-share-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 85, 0, 0.2);
    border: 1px solid rgba(255, 85, 0, 0.4);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    color: #fff;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-item.earned:hover .badge-share-btn {
    opacity: 1;
    transform: translateY(0);
}

.badge-share-btn:hover {
    background: var(--profile-accent);
    transform: scale(1.1) !important;
}

.badge-item.earned .badge-lock {
    display: none;
}

/* Tooltip on hover */
.badge-item:hover .badge-tooltip {
    opacity: 1;
    visibility: visible;
}

.badge-tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a24;
    border: 1px solid var(--profile-border);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* --- STATS ROW --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.stat-card {
    background: var(--profile-card);
    border: 1px solid var(--profile-border);
    padding: 1.5rem;
    border-radius: 20px;
    text-align: left;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--profile-fg-dim);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--profile-fg);
}

/* --- TWO COLUMN PANELS --- */
.panels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.panel {
    background: var(--profile-card);
    border: 1px solid var(--profile-border);
    border-radius: 24px;
    padding: 2rem;
}

/* Mastery Rows */
.mastery-row {
    margin-bottom: 1.5rem;
}

.mastery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.mastery-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.mastery-sutra {
    font-family: 'Noto Serif Devanagari', serif;
    font-size: 0.85rem;
    color: var(--profile-fg-dim);
}

.mastery-bar-outer {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.mastery-bar-inner {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-out;
}

.mastery-label {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mastery-beginner {
    width: 25%;
    background: #22c55e;
    color: #22c55e;
}

.mastery-learning {
    width: 50%;
    background: #eab308;
    color: #eab308;
}

.mastery-skilled {
    width: 75%;
    background: #f97316;
    color: #f97316;
}

.mastery-master {
    width: 100%;
    background: var(--profile-accent);
    color: var(--profile-accent);
}

/* --- HISTORY TABLE --- */
.history-panel {
    margin-top: 2rem;
}

.history-header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.history-table-container {
    overflow-x: auto;
}

.gs-table {
    width: 100%;
    border-collapse: collapse;
}

.gs-table th {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--profile-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--profile-fg-dim);
    font-weight: 600;
}

.gs-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

.history-op-cell {
    font-weight: 700;
}

.history-result-cell {
    font-family: 'JetBrains Mono', monospace;
    color: var(--profile-accent);
}

.history-date-cell {
    font-size: 0.8rem;
    color: var(--profile-fg-dim);
}

.history-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--profile-fg-dim);
}

.btn-load-more {
    display: block;
    width: 200px;
    margin: 2rem auto 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--profile-border);
    color: var(--profile-fg);
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-load-more:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-clear {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    opacity: 0.7;
}

.btn-clear:hover {
    opacity: 1;
}

/* --- PRACTICE PERFORMANCE --- */
.practice-overview {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--profile-border);
}

.accuracy-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 6px solid var(--profile-accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.accuracy-val {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
}

.accuracy-label {
    font-size: 0.6rem;
    text-transform: uppercase;
}

.performance-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.perf-label-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

/* --- LEARNING PATH --- */
.learning-path-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--profile-border);
    border-radius: 16px;
    margin-bottom: 1rem;
    transition: transform 0.2s;
}

.learning-path-row:hover {
    transform: translateX(10px);
    background: rgba(255, 255, 255, 0.04);
}

.module-icon {
    font-size: 1.5rem;
}

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

.module-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.module-level {
    font-size: 0.7rem;
    color: var(--profile-fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.module-status {
    font-weight: 700;
    font-size: 0.8rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .panels-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 2rem;
    }

    .profile-badges-inline {
        justify-content: center;
    }

    .profile-actions {
        justify-content: center;
    }

    .accuracy-overview {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        padding: 1.5rem;
    }

    .avatar-circle {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }

    .profile-email {
        font-size: 1.5rem;
    }

    .panel {
        padding: 1.5rem;
    }

    .practice-overview {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}

/* --- AVATAR ENHANCEMENTS --- */
.avatar-circle-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 30px rgba(255, 85, 0, 0.2);
    border: 3px solid var(--profile-accent);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.avatar-circle-wrapper:hover .avatar-img {
    transform: scale(1.1);
}

.avatar-edit-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 4px 0;
    background: rgba(255, 85, 0, 0.8);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.avatar-circle-wrapper:hover .avatar-edit-overlay {
    opacity: 1;
}

/* Avatar Modal Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 1rem 0;
}

.avatar-option img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: all 0.2s;
    background: var(--profile-card);
}

.avatar-option:hover img {
    border-color: var(--profile-accent);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(255, 85, 0, 0.3);
}