/* ═══════════════════════════════════════════════════════════════════════════
   KARTING DRIVER PROFILE MODULE — MODERN DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════════════════════

   Premium, mobile-first driver profile styled to match BookNow design language.
   Light theme by default, fully themeable via CSS custom properties.

   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 1: DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════════════ */

.scm-mod-KartingDriverProfile {
    /* Primary brand color (configurable via theme) */
    --dp-accent: var(--scm-accent, #2563eb);
    --dp-accent-hover: var(--scm-accent-hover, #1e40af);
    --dp-accent-soft: #eff6ff;
    --dp-accent-glow: rgba(37, 99, 235, 0.25);

    /* Surface colors */
    --dp-bg: var(--scm-surface, #ffffff);
    --dp-bg-elevated: #f8fafc;
    --dp-surface: var(--scm-surface, #f8fafc);

    /* Text colors */
    --dp-text: var(--scm-surface-contrast, #0f172a);
    --dp-text-secondary: var(--scm-text-secondary, #475569);
    --dp-text-tertiary: var(--scm-text-tertiary, #94a3b8);

    /* Border colors */
    --dp-border: var(--scm-border, #e2e8f0);

    /* Semantic colors */
    --dp-gold: #d97706;
    --dp-gold-soft: #fffbeb;
    --dp-green: #059669;
    --dp-green-soft: #ecfdf5;
    --dp-purple: #7c3aed;
    --dp-purple-soft: #f5f3ff;

    /* Typography */
    --dp-font-family: inherit;
    --dp-text-xs: 0.75rem;
    --dp-text-sm: 0.875rem;
    --dp-text-base: 1rem;
    --dp-text-lg: 1.125rem;
    --dp-text-xl: 1.25rem;
    --dp-text-2xl: 1.5rem;
    --dp-text-3xl: 1.875rem;

    /* Spacing */
    --dp-space-1: 0.25rem;
    --dp-space-2: 0.5rem;
    --dp-space-3: 0.75rem;
    --dp-space-4: 1rem;
    --dp-space-5: 1.25rem;
    --dp-space-6: 1.5rem;
    --dp-space-8: 2rem;

    /* Radius */
    --dp-radius-sm: 0.375rem;
    --dp-radius-md: 0.5rem;
    --dp-radius-lg: 0.75rem;
    --dp-radius-xl: 1rem;
    --dp-radius-full: 9999px;

    /* Shadows */
    --dp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --dp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --dp-shadow-card:
        0 0 0 1px rgba(226, 232, 240, 0.5),
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.03);

    /* Transitions */
    --dp-transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Base styles */
    background: var(--dp-bg);
    color: var(--dp-text);
    border-radius: var(--dp-radius-xl);
    padding: var(--dp-space-6);
    font-family: var(--dp-font-family);
    font-size: var(--dp-text-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 2: HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.scm-mod-KartingDriverProfile .dp-header {
    display: flex;
    align-items: flex-start;
    gap: var(--dp-space-5);
    margin-bottom: var(--dp-space-6);
    padding-bottom: var(--dp-space-5);
    border-bottom: 1px solid var(--dp-border);
    flex-wrap: wrap;
}

.scm-mod-KartingDriverProfile .dp-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--dp-radius-full);
    background: var(--dp-accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.scm-mod-KartingDriverProfile .dp-avatar i {
    font-size: 2rem;
    color: var(--dp-accent);
}

.scm-mod-KartingDriverProfile .dp-header-info {
    flex: 1;
    min-width: 0;
}

.scm-mod-KartingDriverProfile .dp-name {
    margin: 0 0 var(--dp-space-1) 0;
    font-size: var(--dp-text-2xl);
    font-weight: 700;
    color: var(--dp-text);
    letter-spacing: -0.025em;
}

.scm-mod-KartingDriverProfile .dp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dp-space-4);
    color: var(--dp-text-secondary);
    font-size: var(--dp-text-sm);
}

.scm-mod-KartingDriverProfile .dp-meta span {
    display: flex;
    align-items: center;
    gap: var(--dp-space-1);
}

.scm-mod-KartingDriverProfile .dp-meta i {
    color: var(--dp-text-tertiary);
}

/* Share Actions */
.scm-mod-KartingDriverProfile .dp-share-actions {
    display: flex;
    gap: var(--dp-space-2);
    flex-wrap: wrap;
}

.scm-mod-KartingDriverProfile .dp-share-actions .btn {
    font-size: var(--dp-text-sm);
    border-radius: var(--dp-radius-full);
    border-color: var(--dp-border);
    color: var(--dp-text-secondary);
    background: var(--dp-bg);
    transition: border-color var(--dp-transition), color var(--dp-transition), background var(--dp-transition);
}

.scm-mod-KartingDriverProfile .dp-share-actions .btn:hover {
    border-color: var(--dp-accent);
    color: var(--dp-accent);
    background: var(--dp-accent-soft);
}

.scm-mod-KartingDriverProfile .dp-qr-overlay {
    background: var(--dp-bg-elevated);
    border: 1px solid var(--dp-border);
    border-radius: var(--dp-radius-lg);
    padding: var(--dp-space-4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 3: GAMIFICATION
   ═══════════════════════════════════════════════════════════════════════════ */

.scm-mod-KartingDriverProfile .dp-gamification {
    font-size: var(--dp-text-sm);
}

.scm-mod-KartingDriverProfile .dp-grade-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: var(--dp-radius-full);
    font-weight: 700;
    font-size: var(--dp-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scm-mod-KartingDriverProfile .dp-grade-rookie { background: #f1f5f9; color: #64748b; }
.scm-mod-KartingDriverProfile .dp-grade-amateur { background: #fef3c7; color: #92400e; }
.scm-mod-KartingDriverProfile .dp-grade-semipro { background: #f1f5f9; color: #475569; }
.scm-mod-KartingDriverProfile .dp-grade-pro { background: var(--dp-gold-soft); color: var(--dp-gold); }
.scm-mod-KartingDriverProfile .dp-grade-elite { background: #fef2f2; color: #dc2626; }

.scm-mod-KartingDriverProfile .dp-score,
.scm-mod-KartingDriverProfile .dp-level,
.scm-mod-KartingDriverProfile .dp-badges {
    color: var(--dp-text-secondary);
    font-weight: 600;
}

.scm-mod-KartingDriverProfile .dp-xp-bar {
    max-width: 300px;
}

.scm-mod-KartingDriverProfile .dp-xp-bar .progress {
    background: var(--dp-border);
}

.scm-mod-KartingDriverProfile .dp-xp-text {
    font-size: var(--dp-text-xs);
    color: var(--dp-text-tertiary);
    text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 4: STATS GRID
   ═══════════════════════════════════════════════════════════════════════════ */

.scm-mod-KartingDriverProfile .dp-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--dp-space-3);
    margin-bottom: var(--dp-space-6);
}

.scm-mod-KartingDriverProfile .dp-stat-card {
    background: var(--dp-bg-elevated);
    border: 1px solid var(--dp-border);
    border-radius: var(--dp-radius-lg);
    padding: var(--dp-space-4);
    text-align: center;
    transition: box-shadow var(--dp-transition), border-color var(--dp-transition);
}

.scm-mod-KartingDriverProfile .dp-stat-card:hover {
    box-shadow: var(--dp-shadow-md);
    border-color: var(--dp-accent);
}

.scm-mod-KartingDriverProfile .dp-stat-highlight {
    border-color: var(--dp-accent);
    background: var(--dp-accent-soft);
}

.scm-mod-KartingDriverProfile .dp-stat-label {
    font-size: var(--dp-text-xs);
    color: var(--dp-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: var(--dp-space-1);
}

.scm-mod-KartingDriverProfile .dp-stat-value {
    font-size: var(--dp-text-xl);
    font-weight: 700;
    color: var(--dp-text);
    font-variant-numeric: tabular-nums;
}

.scm-mod-KartingDriverProfile .dp-stat-detail {
    font-size: 0.7rem;
    color: var(--dp-text-tertiary);
    margin-top: var(--dp-space-1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 5: TROPHIES
   ═══════════════════════════════════════════════════════════════════════════ */

.scm-mod-KartingDriverProfile .dp-trophies {
    display: flex;
    gap: var(--dp-space-3);
    margin-bottom: var(--dp-space-6);
    flex-wrap: wrap;
}

.scm-mod-KartingDriverProfile .dp-trophy {
    display: flex;
    align-items: center;
    gap: var(--dp-space-2);
    padding: var(--dp-space-2) var(--dp-space-4);
    border-radius: var(--dp-radius-full);
    font-size: var(--dp-text-sm);
    font-weight: 600;
}

.scm-mod-KartingDriverProfile .dp-trophy-gold {
    background: var(--dp-gold-soft);
    color: var(--dp-gold);
}

.scm-mod-KartingDriverProfile .dp-trophy-green {
    background: var(--dp-green-soft);
    color: var(--dp-green);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 6: SECTIONS & TABLES
   ═══════════════════════════════════════════════════════════════════════════ */

.scm-mod-KartingDriverProfile .dp-section {
    margin-bottom: var(--dp-space-6);
}

.scm-mod-KartingDriverProfile .dp-section-title {
    font-size: var(--dp-text-base);
    font-weight: 600;
    margin-bottom: var(--dp-space-3);
    display: flex;
    align-items: center;
    gap: var(--dp-space-2);
    color: var(--dp-text);
}

.scm-mod-KartingDriverProfile .dp-section-title i {
    color: var(--dp-accent);
}

.scm-mod-KartingDriverProfile .dp-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--dp-border);
    border-radius: var(--dp-radius-lg);
}

.scm-mod-KartingDriverProfile .dp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--dp-text-sm);
}

.scm-mod-KartingDriverProfile .dp-table th {
    text-align: left;
    padding: var(--dp-space-3) var(--dp-space-4);
    color: var(--dp-text-secondary);
    font-size: var(--dp-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--dp-bg-elevated);
    border-bottom: 1px solid var(--dp-border);
}

.scm-mod-KartingDriverProfile .dp-table td {
    padding: var(--dp-space-3) var(--dp-space-4);
    border-bottom: 1px solid var(--dp-border);
    color: var(--dp-text);
}

.scm-mod-KartingDriverProfile .dp-table tbody tr:last-child td {
    border-bottom: none;
}

.scm-mod-KartingDriverProfile .dp-table tbody tr:hover {
    background: var(--dp-bg-elevated);
}

.scm-mod-KartingDriverProfile .dp-time {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--dp-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 7: EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.scm-mod-KartingDriverProfile .dp-empty-state {
    text-align: center;
    padding: var(--dp-space-8) var(--dp-space-4);
    color: var(--dp-text-secondary);
}

.scm-mod-KartingDriverProfile .dp-empty-state i {
    font-size: 3rem;
    margin-bottom: var(--dp-space-3);
    display: block;
    color: var(--dp-text-tertiary);
}

.scm-mod-KartingDriverProfile .dp-empty-state h3 {
    font-size: var(--dp-text-lg);
    font-weight: 600;
    margin-bottom: var(--dp-space-2);
    color: var(--dp-text);
}

.scm-mod-KartingDriverProfile .dp-empty-state p {
    font-size: var(--dp-text-sm);
    color: var(--dp-text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 8: SIZE VARIANTS
   ═══════════════════════════════════════════════════════════════════════════ */

.scm-mod-KartingDriverProfile.scm-mod-compact {
    padding: var(--dp-space-3);
    font-size: var(--dp-text-sm);
}

.scm-mod-KartingDriverProfile.scm-mod-compact .dp-name {
    font-size: var(--dp-text-lg);
}

.scm-mod-KartingDriverProfile.scm-mod-large {
    padding: var(--dp-space-8);
}

.scm-mod-KartingDriverProfile.scm-mod-fullheight {
    min-height: calc(100vh - 200px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 9: RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 576px) {
    .scm-mod-KartingDriverProfile {
        padding: var(--dp-space-4);
        border-radius: var(--dp-radius-lg);
    }

    .scm-mod-KartingDriverProfile .dp-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .scm-mod-KartingDriverProfile .dp-meta {
        justify-content: center;
    }

    .scm-mod-KartingDriverProfile .dp-share-actions {
        justify-content: center;
    }

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

    .scm-mod-KartingDriverProfile .dp-trophies {
        justify-content: center;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 10: REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .scm-mod-KartingDriverProfile,
    .scm-mod-KartingDriverProfile * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── P4 Gamification: streaks + weekly quests engagement panel (2026-07) ── */

.dp-engagement {
    padding: 0.9rem 1.1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dp-streaks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dp-streak-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.dp-streak-chip.active {
    color: #ffb454;
    background: rgba(255, 140, 40, 0.12);
    border-color: rgba(255, 140, 40, 0.35);
}

.dp-streak-count {
    font-weight: 800;
    font-size: 0.95rem;
}

.dp-section-label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.6;
    margin-bottom: 0.4rem;
}

.dp-quest {
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dp-quest:first-of-type {
    border-top: none;
}

.dp-quest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.dp-quest-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.dp-quest-progress {
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0.7;
    white-space: nowrap;
}

.dp-quest-steps {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.dp-quest-step {
    font-size: 1rem;
    opacity: 0.45;
}

.dp-quest-step.done {
    color: #3ecf6e;
    opacity: 1;
}
