/* ==========================================================================
   Deep Tech Style Design System - Common Styles and Components
   ========================================================================== */

/* ==================== Base Color System ==================== */
:root {
    /* Theme background colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-card: #1e2a1e;
    --bg-overlay: rgba(0, 0, 0, 0.8);
    
    /* Green theme series */
    --primary-green: #00ff88;
    --secondary-green: #00cc6a;
    --accent-green: #33ff99;
    --dark-green: #004d2a;
    --light-green: #66ffaa;
    
    /* Functional colors */
    --success-color: #00ff88;
    --warning-color: #ffd700;
    --error-color: #ff4444;
    --info-color: #00aaff;
    
    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --text-disabled: #555555;
    --text-inverse: #000000;
    
    /* Gradient system */
    --gradient-primary: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    --gradient-secondary: linear-gradient(135deg, #33ff99 0%, #00ff88 100%);
    --gradient-bg-card: linear-gradient(135deg, #1e2a1e 0%, #2a3a2a 100%);
    --gradient-warning: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    --gradient-error: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
    
    /* Shadow and glow system */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glow-primary: 0 0 20px rgba(0, 255, 136, 0.4);
    --glow-strong: 0 0 30px rgba(0, 255, 136, 0.6);
    --glow-subtle: 0 0 10px rgba(0, 255, 136, 0.3);
    
    /* Spacing and dimensions */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;
    
    /* Animation duration */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Font families */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    
    /* Font sizes */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 30px;
    --text-4xl: 36px;
    --text-5xl: 48px;
    
    /* Font weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-black: 900;
    
    /* Line heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.75;
}

/* ==========================================================================
   Global Base Style Reset
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

html,
body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Link styles */
a {
    color: var(--primary-green);
    text-decoration: none;
    transition: color var(--transition-normal);
}

a:hover {
    color: var(--accent-green);
}

a:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* Form element base styles */
input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    transition: all var(--transition-normal);
}

button:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   Font Utility Classes
   ========================================================================== */

.text-xs { font-size: var(--text-xs); line-height: var(--leading-normal); }
.text-sm { font-size: var(--text-sm); line-height: var(--leading-normal); }
.text-base { font-size: var(--text-base); line-height: var(--leading-normal); }
.text-lg { font-size: var(--text-lg); line-height: var(--leading-normal); }
.text-xl { font-size: var(--text-xl); line-height: var(--leading-tight); }
.text-2xl { font-size: var(--text-2xl); line-height: var(--leading-tight); }
.text-3xl { font-size: var(--text-3xl); line-height: var(--leading-tight); }
.text-4xl { font-size: var(--text-4xl); line-height: var(--leading-tight); }

.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-black { font-weight: var(--font-black); }

/* Text color utility classes */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--primary-green); text-shadow: var(--glow-subtle); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-error { color: var(--error-color); }

/* ==========================================================================
   Button Component System
   ========================================================================== */

/* Base button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
    outline: none;
    text-decoration: none;
    user-select: none;
}

/* Primary button */
.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: var(--glow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-strong);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary button */
.btn-secondary {
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
}

.btn-secondary:hover {
    background: var(--primary-green);
    color: var(--text-inverse);
    box-shadow: var(--glow-primary);
}

/* Outline button */
.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Button size variants */
.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
}

.btn-lg {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--text-lg);
}

.btn-full {
    width: 100%;
}

/* Button states */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn.loading {
    pointer-events: none;
}

/* Button glow animation */
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn:hover::before {
    transform: translateX(100%);
}

/* ==========================================================================
   Card Component System
   ========================================================================== */

/* Base card styles */
.card {
    background: var(--gradient-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 255, 136, 0.2);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition-normal);
    position: relative;
}

.card:hover {
    border-color: var(--primary-green);
    transform: translateY(-4px);
    box-shadow: var(--glow-primary), var(--shadow-lg);
}

/* Card areas */
.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.card-content {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

/* Card variants */
.card-highlight {
    border-color: var(--primary-green);
    box-shadow: var(--glow-subtle);
}

.card-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.card-compact .card-header,
.card-compact .card-content,
.card-compact .card-footer {
    padding: var(--space-md);
}

/* Card titles */
.card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

/* ==========================================================================
   Form Component System
   ========================================================================== */

/* Form groups */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group:last-child {
    margin-bottom: 0;
}

/* Form labels */
.form-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-label .label-icon {
    width: 16px;
    height: 16px;
    color: var(--primary-green);
    stroke-width: 2;
}

/* Input container */
.input-container {
    position: relative;
}

/* Base input field */
.form-input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    transition: var(--transition-normal);
    outline: none;
    box-sizing: border-box;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--primary-green);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: var(--glow-primary);
    transform: translateY(-1px);
}

.form-input:hover {
    border-color: rgba(0, 255, 136, 0.3);
}

/* Input field states */
.form-input.error {
    border-color: var(--error-color);
    background: rgba(255, 68, 68, 0.1);
}

.form-input.success {
    border-color: var(--success-color);
    background: rgba(0, 255, 136, 0.1);
}

/* Input field glow */
.input-glow {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
    filter: blur(8px);
}

.form-input:focus + .input-glow {
    opacity: 0.2;
}

/* Error messages */
.error-message {
    font-size: var(--text-xs);
    color: var(--error-color);
    margin-top: var(--space-sm);
    min-height: 18px;
    opacity: 0;
    transform: translateY(-4px);
    transition: var(--transition-normal);
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Checkboxes and radio buttons */
.form-checkbox,
.form-radio {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    position: relative;
    cursor: pointer;
    transition: var(--transition-normal);
}

.form-checkbox {
    border-radius: 4px;
}

.form-radio {
    border-radius: 50%;
}

.form-checkbox:checked,
.form-radio:checked {
    background: var(--gradient-primary);
    border-color: var(--primary-green);
    box-shadow: var(--glow-primary);
}

.form-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-inverse);
    font-size: 12px;
    font-weight: var(--font-bold);
}

.form-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--text-inverse);
    border-radius: 50%;
}

/* ==========================================================================
   Animation Effects Library
   ========================================================================== */

/* Fade in animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Pulse animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: var(--glow-primary); }
    50% { box-shadow: var(--glow-strong); }
}

/* Rotation animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -30px, 0);
    }
    70% {
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Scale animation */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation utility classes */
.animate-fadeIn { animation: fadeIn 0.6s ease-out; }
.animate-fadeInUp { animation: fadeInUp 0.6s ease-out; }
.animate-fadeInDown { animation: fadeInDown 0.6s ease-out; }
.animate-fadeInLeft { animation: fadeInLeft 0.6s ease-out; }
.animate-fadeInRight { animation: fadeInRight 0.6s ease-out; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-pulseGlow { animation: pulseGlow 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-bounce { animation: bounce 2s infinite; }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-zoomIn { animation: zoomIn 0.5s ease-out; }

/* Delayed animations */
.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-500 { animation-delay: 0.5s; }

/* ==========================================================================
   Layout and Responsive System
   ========================================================================== */

/* Grid system */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Flexbox layout */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.flex-1 { flex: 1; }
.flex-auto { flex: auto; }
.flex-none { flex: none; }

/* Spacing utility classes */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }

.p-0 { padding: 0; }
.px-0 { padding-left: 0; padding-right: 0; }
.py-0 { padding-top: 0; padding-bottom: 0; }

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ==========================================================================
   Bottom Navigation Component
   ========================================================================== */

.bottom-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--gradient-bg-card);
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
    color: var(--text-muted);
    position: relative;
    flex: 1;
    max-width: 80px;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 0 0 3px 3px;
    transition: width 0.3s ease;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-green);
    background: rgba(0, 255, 136, 0.1);
    transform: translateY(-2px);
}

.nav-item:hover::before,
.nav-item.active::before {
    width: 60%;
}

.nav-icon {
    width: 24px;
    height: 24px;
    position: relative;
    transition: var(--transition-normal);
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 2;
    transition: var(--transition-normal);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    transform: scale(1.1);
    filter: drop-shadow(var(--glow-subtle));
}

.nav-label {
    font-size: 10px;
    font-weight: var(--font-medium);
    transition: var(--transition-normal);
}

.nav-item:hover .nav-label,
.nav-item.active .nav-label {
    font-weight: var(--font-semibold);
}

/* Navigation item click animation */
.nav-item:active {
    transform: translateY(0) scale(0.95);
}

/* ==========================================================================
   Common Header Styles
   ========================================================================== */

.common-header {
    background: var(--bg-primary);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    box-shadow: var(--shadow-sm);
}

.common-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
}

.common-header-title {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: var(--font-semibold);
    text-align: center;
    font-family: var(--font-primary);
    flex: 1;
    margin: 0;
}

.common-header .back-button {
    position: absolute;
    left: 16px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: var(--primary-green);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.common-header .back-button:hover {
    background: rgba(0, 255, 136, 0.2);
    box-shadow: var(--glow-subtle);
    transform: translateY(-1px);
}

.common-header .back-button svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* ==========================================================================
   Utility Class System
   ========================================================================== */

.hidden { display: none !important; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }

.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Position and z-index */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.break-words { word-wrap: break-word; }
.break-all { word-break: break-all; }

/* ==========================================================================
   Toast Notification System
   ========================================================================== */

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    border: 1px solid rgba(0, 255, 136, 0.3);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

.toast.success {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--success-color);
    color: var(--success-color);
}

.toast.error {
    background: rgba(255, 68, 68, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

.toast.warning {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.toast.info {
    background: rgba(0, 170, 255, 0.1);
    border-color: var(--info-color);
    color: var(--info-color);
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.loading-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.loading-mask.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 255, 136, 0.3);
    border-top-color: var(--primary-green);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-sm);
    }
    
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    
    .md\:grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
    .md\:flex-col { flex-direction: column; }
}

@media (max-width: 480px) {
    .bottom-navigation {
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    }
    
    .nav-item {
        padding: 6px 8px;
        max-width: 70px;
    }
    
    .nav-icon {
        width: 20px;
        height: 20px;
    }
    
    .nav-label {
        font-size: 9px;
    }
    
    .grid-cols-2 { grid-template-columns: repeat(1, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(1, 1fr); }
    .grid-cols-4 { grid-template-columns: repeat(1, 1fr); }
    
    .sm\:grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
    .sm\:flex-col { flex-direction: column; }
    .sm\:text-center { text-align: center; }
    
    .common-header {
        padding: 16px 0;
    }
    
    .common-header-title {
        font-size: 18px;
    }
    
    .common-header .back-button {
        padding: 8px;
    }
}

/* ==========================================================================
   Page Container
   ========================================================================== */

.page-container {
    min-height: 100vh;
    background-color: var(--bg-primary);
    font-family: var(--font-primary);
}

.page-container.with-common-header {
    padding-top: 0;
}

.page-container.with-common-header .main-content {
    margin-top: 0;
}

/* ==========================================================================
   Common Header Animation
   ========================================================================== */

.common-header.fade-in {
    animation: headerFadeIn 0.6s ease-out forwards;
}

@keyframes headerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Accessibility and Usability Optimization
   ========================================================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-secondary: #cccccc;
        --text-muted: #aaaaaa;
    }
}

/* Reduced motion mode support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Touch device optimization */
@media (pointer: coarse) {
    .btn,
    .nav-item,
    .form-input {
        min-height: 44px;
    }
}
