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

:root {
    /* Font Families */
    --md-sys-typescale-brand-font: 'Outfit', sans-serif;
    --md-sys-typescale-plain-font: 'Inter', sans-serif;

    /* Light Theme (Default) */
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    
    --md-sys-color-tertiary: #7D5260;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #FFD8E4;
    --md-sys-color-on-tertiary-container: #31111D;

    --md-sys-color-error: #B3261E;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #F9DEDC;
    --md-sys-color-on-error-container: #410E0B;

    --md-sys-color-background: #FEF7FF;
    --md-sys-color-on-background: #1D1B20;
    --md-sys-color-surface: #F7F2FA;
    --md-sys-color-on-surface: #1D1B20;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-on-surface-variant: #49454F;
    
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #C4C7C5;

    /* Extra semantic colors for status */
    --status-pending: #8E918F;
    --status-pending-container: #E1E3E1;
    --status-pending-on-container: #1A1C1A;

    --status-current: #00639A;
    --status-current-container: #C1E8FF;
    --status-current-on-container: #001D35;

    --status-completed: #386A20;
    --status-completed-container: #B8F397;
    --status-completed-on-container: #042100;

    --shadow-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    --shadow-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    --shadow-elevation-3: 0px 1px 3px 0px rgba(0, 0, 0, 0.3), 0px 4px 8px 3px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    /* Dark Theme Override */
    --md-sys-color-primary: #D0BCFF;
    --md-sys-color-on-primary: #381E72;
    --md-sys-color-primary-container: #4F378B;
    --md-sys-color-on-primary-container: #EADDFF;

    --md-sys-color-secondary: #CCC2DC;
    --md-sys-color-on-secondary: #332D41;
    --md-sys-color-secondary-container: #4A4458;
    --md-sys-color-on-secondary-container: #E8DEF8;

    --md-sys-color-tertiary: #EFB8C8;
    --md-sys-color-on-tertiary: #492532;
    --md-sys-color-tertiary-container: #633B48;
    --md-sys-color-on-tertiary-container: #FFD8E4;

    --md-sys-color-error: #F2B8B5;
    --md-sys-color-on-error: #601410;
    --md-sys-color-error-container: #8C1D18;
    --md-sys-color-on-error-container: #F9DEDC;

    --md-sys-color-background: #141218;
    --md-sys-color-on-background: #E6E1E5;
    --md-sys-color-surface: #1D1B20;
    --md-sys-color-on-surface: #E6E1E5;
    --md-sys-color-surface-variant: #49454F;
    --md-sys-color-on-surface-variant: #CAC4D0;

    --md-sys-color-outline: #938F99;
    --md-sys-color-outline-variant: #444746;

    --status-pending: #8E918F;
    --status-pending-container: #2F312E;
    --status-pending-on-container: #E1E3E1;

    --status-current: #93CFFF;
    --status-current-container: #004B76;
    --status-current-on-container: #C1E8FF;

    --status-completed: #9CD67D;
    --status-completed-container: #205107;
    --status-completed-on-container: #B8F397;

    --shadow-elevation-1: 0px 1px 2px 0px rgba(0, 0, 0, 0.30), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
    --shadow-elevation-2: 0px 1px 2px 0px rgba(0, 0, 0, 0.30), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
    --shadow-elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.3), 0px 8px 12px 6px rgba(0, 0, 0, 0.15);

    /* Bootstrap utility overrides for dark mode readability */
    .text-secondary {
        color: #CAC4D0 !important;
    }
    .text-muted {
        color: #938F99 !important;
    }
    .text-dark {
        color: #E6E1E5 !important;
    }
    .bg-light {
        background-color: #2D2A31 !important;
        color: #E6E1E5 !important;
    }
    .bg-white {
        background-color: #1D1B20 !important;
        color: #E6E1E5 !important;
    }
    .border-light, .border-light-subtle {
        border-color: #444746 !important;
    }
    .btn-outline-secondary {
        color: #CAC4D0 !important;
        border-color: #938F99 !important;
    }
    .btn-outline-secondary:hover {
        background-color: #332D41 !important;
        color: #FEF7FF !important;
    }
}

/* Global Styles */
body {
    font-family: var(--md-sys-typescale-plain-font);
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .brand-font {
    font-family: var(--md-sys-typescale-brand-font);
    font-weight: 600;
}

/* Material Layout Components */
.navbar-custom {
    background-color: var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    padding: 0.75rem 1.5rem;
}

.footer-custom {
    background-color: var(--md-sys-color-surface);
    border-top: 1px solid var(--md-sys-color-surface-variant);
    padding: 1.5rem 0;
    margin-top: auto;
}

/* Material Design Card Styles */
.card-md {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: none;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.card-md:hover {
    box-shadow: var(--shadow-elevation-2);
    border-color: var(--md-sys-color-outline);
}

.card-elevated {
    background-color: var(--md-sys-color-surface);
    border: none;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-elevation-1);
    transition: box-shadow 0.3s cubic-bezier(0.2, 0, 0, 1), transform 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.card-elevated:hover {
    box-shadow: var(--shadow-elevation-3);
    transform: translateY(-4px);
}

/* Button Material Styling */
.btn-md {
    border-radius: 100px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.1px;
    transition: box-shadow 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
    border: none;
}

.btn-md:active {
    transform: scale(0.97);
}

.btn-md-primary {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-md-primary:hover {
    background-color: var(--md-sys-color-primary);
    filter: brightness(0.9);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--shadow-elevation-1);
}

.btn-md-secondary {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.btn-md-secondary:hover {
    background-color: var(--md-sys-color-secondary-container);
    filter: brightness(0.92);
    color: var(--md-sys-color-on-secondary-container);
}

.btn-md-outlined {
    background-color: transparent;
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
}

.btn-md-outlined:hover {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-color: var(--md-sys-color-primary);
}

/* Floating Action Button (FAB) */
.fab-md {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-elevation-2);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease;
    z-index: 1000;
    border: none;
}

.fab-md:hover {
    box-shadow: var(--shadow-elevation-3);
    transform: scale(1.05);
}

/* Form inputs styling */
.form-control-md {
    background-color: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: var(--md-sys-color-on-background);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control-md:focus {
    background-color: transparent;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    box-shadow: none;
    color: var(--md-sys-color-on-background);
}

.form-label-md {
    font-size: 0.85rem;
    color: var(--md-sys-color-on-background);
    background-color: var(--md-sys-color-background);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--md-sys-color-surface-variant);
}

/* Vertical Roadmap Timeline Styles */
.timeline-wrapper {
    position: relative;
    padding-left: 2.5rem;
    margin: 2rem 0;
}

.timeline-line {
    position: absolute;
    left: 17px;
    top: 10px;
    bottom: 10px;
    width: 4px;
    background: var(--md-sys-color-outline-variant);
    z-index: 1;
    border-radius: 2px;
}

.timeline-line-progress {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 0;
    background: var(--md-sys-color-primary);
    transition: height 0.8s ease-in-out;
}

.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
    z-index: 2;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-node {
    position: absolute;
    left: -2.5rem;
    top: 4px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
    box-shadow: var(--shadow-elevation-1);
    transition: all 0.3s ease;
    border: 3px solid var(--md-sys-color-background);
}

/* Status variants */
.timeline-item.pending .timeline-node {
    background-color: var(--status-pending-container);
    color: var(--status-pending-on-container);
}

.timeline-item.pending .card-timeline {
    border-left: 5px solid var(--status-pending);
    opacity: 0.8;
}

.timeline-item.current .timeline-node {
    background-color: var(--status-current-container);
    color: var(--status-current-on-container);
    box-shadow: 0 0 0 4px var(--md-sys-color-primary-container);
    animation: pulse-glow 2s infinite;
}

.timeline-item.current .card-timeline {
    border-left: 5px solid var(--md-sys-color-primary);
    box-shadow: var(--shadow-elevation-2);
}

.timeline-item.completed .timeline-node {
    background-color: var(--status-completed-container);
    color: var(--status-completed-on-container);
}

.timeline-item.completed .card-timeline {
    border-left: 5px solid var(--status-completed);
}

.card-timeline {
    background-color: var(--md-sys-color-surface);
    border-radius: 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 1.25rem;
    transition: all 0.25s ease;
}

.card-timeline:hover {
    box-shadow: var(--shadow-elevation-2);
}

/* Progress Circular Badge */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.35s;
    transform-origin: 50% 50%;
}

/* Animations */
@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0px rgba(103, 80, 164, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(103, 80, 164, 0);
    }
    100% {
        box-shadow: 0 0 0 0px rgba(103, 80, 164, 0);
    }
}

/* Success Celebration Popups */
.completion-success-popup {
    animation: zoom-in-bounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes zoom-in-bounce {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.1);
    }
    80% {
        transform: scale(0.97);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Custom badges */
.badge-md {
    border-radius: 8px;
    padding: 0.35em 0.65em;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.1px;
}

.badge-md-pending {
    background-color: var(--status-pending-container);
    color: var(--status-pending-on-container);
}

.badge-md-current {
    background-color: var(--status-current-container);
    color: var(--status-current-on-container);
}

.badge-md-completed {
    background-color: var(--status-completed-container);
    color: var(--status-completed-on-container);
}

/* Dashboard Statistics Badge */
.stat-box {
    text-align: center;
    border-radius: 16px;
    padding: 1.25rem;
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--md-sys-color-primary);
    margin-bottom: 0.2rem;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Profile photo circle container */
.profile-photo-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem auto;
}

.profile-photo-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--md-sys-color-primary-container);
}

.profile-photo-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--md-sys-color-background);
    transition: transform 0.2s ease;
}

.profile-photo-edit-btn:hover {
    transform: scale(1.1);
}

/* Multi-step registration */
.step-container {
    display: none;
}

.step-container.active {
    display: block;
}

.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.step-dot {
    width: 33.33%;
    height: 4px;
    background-color: var(--md-sys-color-outline-variant);
    margin-right: 4px;
    border-radius: 2px;
}

.step-dot:last-child {
    margin-right: 0;
}

.step-dot.active {
    background-color: var(--md-sys-color-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--md-sys-color-background);
}

::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline);
}

/* Scratch Card & Rewards Styling */
.bg-gradient-reward {
    background: linear-gradient(135deg, #fffcf5 0%, #fff9e6 100%);
    border-bottom: 1px solid #ffeeba !important;
}

[data-theme="dark"] .bg-gradient-reward {
    background: linear-gradient(135deg, #2a2415 0%, #1e190d 100%) !important;
    border-bottom: 1px solid #4a3e21 !important;
}

.pulse-glow {
    animation: pulse-glow-warning 2.5s infinite;
}

@keyframes pulse-glow-warning {
    0% {
        box-shadow: 0 0 0 0px rgba(255, 193, 7, 0.5);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
    100% {
        box-shadow: 0 0 0 0px rgba(255, 193, 7, 0);
    }
}

.scratch-card-container {
    position: relative;
    width: 260px;
    height: 150px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    user-select: none;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.scratch-card-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #fffbf0 0%, #ffeaa7 100%);
    border-radius: 16px;
    z-index: 1;
}

[data-theme="dark"] .scratch-card-content {
    background: radial-gradient(circle, #2d2412 0%, #1a150a 100%) !important;
}

.scratch-card-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: crosshair;
    border-radius: 16px;
    touch-action: none;
}

/* Mobile Dashboard Layout Reordering and Compacting */
@media (max-width: 767.98px) {
    .dashboard-main-flow {
        display: flex;
        flex-direction: column;
    }
    .flow-welcome {
        order: 1;
    }
    .flow-roadmap {
        order: 2;
    }
    .flow-stats-cards {
        order: 3;
    }
    
    /* Compact Navbar for Mobile views to prevent wrapping */
    .navbar-custom {
        padding: 0.5rem 0.75rem !important;
    }
    .navbar-custom .navbar-brand {
        margin-right: 0.5rem;
    }
    .navbar-custom .navbar-brand .material-icons {
        font-size: 1.6rem !important;
        margin-right: 0.25rem !important;
    }
    .navbar-custom .navbar-brand span:not(.material-icons) {
        font-size: 1.15rem !important;
    }
    .navbar-custom .theme-toggle-btn {
        width: 34px !important;
        height: 34px !important;
        margin-right: 0.25rem !important;
    }
    .navbar-custom .theme-toggle-btn .material-icons {
        font-size: 1.25rem !important;
    }
    .navbar-custom .dropdown img {
        width: 32px !important;
        height: 32px !important;
    }
    .navbar-custom .navbar-toggler {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.85rem !important;
        margin-left: 0.25rem !important;
    }
}
