/**
 * Material Design Styles for Quiz Application
 * Based on Material Design 3 principles
 */

/* ========================================
   CSS Variables - Color Scheme
   ======================================== */
:root {
    /* Primary Colors */
    --primary: #1976D2;
    --primary-light: #42A5F5;
    --primary-dark: #0D47A1;

    /* Secondary Colors */
    --secondary: #FFC107;
    --secondary-light: #FFD54F;

    /* Status Colors */
    --success: #4CAF50;
    --error: #F44336;
    --warning: #FF9800;

    /* Background Colors */
    --background: #FAFAFA;
    --surface: #FFFFFF;
    --on-surface: #212121;
    --on-surface-variant: #757575;

    /* Shadows */
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-raised: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-high: 0 8px 16px rgba(0,0,0,0.2);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ========================================
   Reset & Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--on-surface);
    background-color: var(--background);
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Prevent text selection on double-tap */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ========================================
   Material Card Component
   ======================================== */
.mdc-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mdc-card:hover {
    box-shadow: var(--shadow-raised);
}

.mdc-card.elevated {
    box-shadow: var(--shadow-raised);
}

.mdc-card.elevated:hover {
    box-shadow: var(--shadow-high);
}

/* ========================================
   Material Button Component
   ======================================== */
.mdc-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    min-width: 64px;
    min-height: 48px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.mdc-button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Button */
.mdc-button-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.mdc-button-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-raised);
}

.mdc-button-primary:active {
    box-shadow: var(--shadow);
    transform: translateY(1px);
}

/* Secondary Button */
.mdc-button-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.mdc-button-secondary:hover {
    background: rgba(25, 118, 210, 0.08);
}

.mdc-button-secondary:active {
    background: rgba(25, 118, 210, 0.16);
}

/* Success Button */
.mdc-button-success {
    background: var(--success);
    color: white;
    box-shadow: var(--shadow);
}

.mdc-button-success:hover {
    background: #388E3C;
    box-shadow: var(--shadow-raised);
}

/* Error Button */
.mdc-button-error {
    background: var(--error);
    color: white;
    box-shadow: var(--shadow);
}

.mdc-button-error:hover {
    background: #D32F2F;
    box-shadow: var(--shadow-raised);
}

/* ========================================
   Material Checkbox Component
   ======================================== */
.mdc-checkbox {
    display: flex;
    align-items: center;
    padding: 12px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mdc-checkbox:hover {
    background-color: rgba(25, 118, 210, 0.08);
}

.mdc-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin: 0 16px 0 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.mdc-checkbox input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.mdc-checkbox label {
    flex: 1;
    cursor: pointer;
    font-size: 16px;
    line-height: 1.5;
}

/* Checkbox Feedback States */
.mdc-checkbox.correct {
    background-color: rgba(76, 175, 80, 0.12);
    border-left: 4px solid var(--success);
    padding-left: calc(12px - 4px);
}

.mdc-checkbox.wrong {
    background-color: rgba(244, 67, 54, 0.12);
    border-left: 4px solid var(--error);
    padding-left: calc(12px - 4px);
}

.mdc-checkbox.missed {
    background-color: rgba(255, 193, 7, 0.12);
    border-left: 4px solid var(--warning);
    padding-left: calc(12px - 4px);
}

.mdc-checkbox.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   Material Progress Bar
   ======================================== */
.mdc-progress {
    height: 4px;
    background: rgba(25, 118, 210, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: var(--spacing-md) 0;
}

.mdc-progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

/* ========================================
   Material Spinner (Loading)
   ======================================== */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(25, 118, 210, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Material Dialog/Modal
   ======================================== */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-md);
}

.dialog-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-high);
}

.dialog-content h3 {
    margin-bottom: var(--spacing-md);
    color: var(--on-surface);
}

.dialog-content p {
    margin-bottom: var(--spacing-lg);
    color: var(--on-surface-variant);
    line-height: 1.6;
}

.dialog-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

/* ========================================
   Material List
   ======================================== */
.mdc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mdc-list-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    min-height: 48px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mdc-list-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.mdc-list-item:active {
    background-color: rgba(0, 0, 0, 0.08);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: var(--spacing-md);
}

.subtitle {
    color: var(--on-surface-variant);
    font-size: 0.875rem;
}

/* ========================================
   Responsive Design - Mobile First
   ======================================== */

/* Tablet (600px and up) */
@media (min-width: 600px) {
    body {
        font-size: 16px;
    }

    .mdc-card {
        padding: var(--spacing-lg);
    }

    .dialog-content {
        padding: var(--spacing-xl);
    }
}

/* Desktop (960px and up) */
@media (min-width: 960px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }
}

/* Landscape orientation optimization */
@media (orientation: landscape) and (max-height: 600px) {
    .mdc-card {
        padding: var(--spacing-sm) var(--spacing-md);
        margin: var(--spacing-sm) 0;
    }

    .mdc-button {
        min-height: 40px;
        padding: 8px 16px;
    }

    .mdc-checkbox {
        min-height: 40px;
        padding: 8px;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }
