@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ─── COMMON SHARED STYLES ───
   Used by HeaderComponent and shared across all pages
   ─────────────────────────────────────────────────── */

:root {
    /* Color system */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --dark-gradient: linear-gradient(145deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glow-primary: 0 0 40px rgba(102, 126, 234, 0.4);
    --glow-success: 0 0 30px rgba(56, 239, 125, 0.5);

    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Accent colors */
    --accent-coral: #f5576c;
    --accent-mint: #38ef7d;
    --accent-lavender: #667eea;
    --accent-cyan: #22d3ee;
    --accent-blue: #3b82f6;

    /* Background colors */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.12);

    /* Sizing */
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
    --control-bar-height: 80px;
    --footer-nav-height: 68px;
    --search-height: 56px;

    /* Effects */
    --blur-strong: blur(20px);
    --blur-light: blur(10px);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-sm: 12px;
    --border-radius-md: 20px;
    --border-radius-lg: 28px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ─── PAGE CONTAINER ─── */
.mobile-training-container {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-primary);
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: none;
}

/* ─── HEADER ─── */
.mobile-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 16px 16px;
    padding-top: max(24px, calc(env(safe-area-inset-top) + 12px));
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

/* ─── BACK NAVIGATION ─── */
.mobile-back-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.mobile-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px 10px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    overflow: hidden;
}

.mobile-back-btn:hover,
.mobile-back-btn:active {
    background: rgba(34, 211, 238, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.2);
}

.mobile-back-btn:active {
    transform: scale(0.96);
}

.mobile-back-arrow {
    width: 20px;
    height: 20px;
    min-width: 20px;
    max-width: 20px;
    min-height: 20px;
    max-height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.mobile-back-btn:hover .mobile-back-arrow,
.mobile-back-btn:active .mobile-back-arrow {
    transform: translateX(-3px);
}

.mobile-back-text {
    background: linear-gradient(to right, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── PAGE TITLE ─── */
.mobile-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    background: linear-gradient(to right, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── SEARCH BAR ─── */
.mobile-search-container {
    position: relative;
    padding: 8px 0;
}

.mobile-search-input {
    width: 100%;
    height: 44px;
    padding: 0 16px 0 48px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--glass-border);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    outline: none;
    transition: var(--transition-smooth);
}

.mobile-search-input::placeholder {
    color: var(--text-muted);
}

.mobile-search-input:focus {
    border-color: var(--accent-lavender);
    box-shadow: var(--glow-primary);
}

.mobile-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

/* ─── LOADING STATE ─── */
.mobile-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 32px;
    gap: 16px;
}

.mobile-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-lavender);
    border-radius: 50%;
    animation: common-spin 0.8s linear infinite;
}

.mobile-loading-text {
    font-size: 15px;
    color: var(--text-secondary);
}

/* ─── EMPTY STATE ─── */
.mobile-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 32px;
    text-align: center;
    animation: common-fadeIn 0.4s ease-out;
}

.mobile-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.mobile-empty-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.mobile-empty-description {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 280px;
    line-height: 1.4;
}

/* ─── ERROR STATE ─── */
.mobile-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 32px;
    text-align: center;
}

.mobile-retry-btn {
    margin-top: 20px;
    padding: 16px 32px;
    background: linear-gradient(135deg, rgba(31, 41, 55, 0.8) 0%, rgba(17, 24, 39, 0.8) 100%);
    border: 1px solid var(--accent-cyan);
    border-radius: 50px;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mobile-retry-btn:active {
    transform: scale(0.96);
    box-shadow: var(--glow-primary);
}

/* ─── TOAST NOTIFICATION ─── */
.mobile-toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: common-fadeIn 0.2s ease-out;
}

.mobile-toast {
    padding: 20px 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    animation: common-toastPop 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.mobile-toast.success {
    background: var(--success-gradient);
    color: white;
    box-shadow: var(--card-shadow), var(--glow-success);
}

.mobile-toast.error {
    background-color: #ef4444;
    color: white;
}

.mobile-toast-icon {
    font-size: 1.5rem;
}

/* ─── MODAL (shared bottom-sheet pattern) ─── */
.mobile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: var(--blur-strong);
    -webkit-backdrop-filter: var(--blur-strong);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
    animation: common-fadeIn 0.25s ease-out;
}

.mobile-modal-content {
    width: 100%;
    max-height: 90vh;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    overflow: hidden;
    animation: common-slideUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.mobile-modal-handle {
    width: 100%;
    padding: 8px 0;
    display: flex;
    justify-content: center;
}

.mobile-modal-handle::after {
    content: '';
    width: 36px;
    height: 5px;
    background: var(--glass-border);
    border-radius: 3px;
}

.mobile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 16px;
    border-bottom: 1px solid var(--glass-border);
}

.mobile-modal-title-group {
    flex: 1;
    min-width: 0;
}

.mobile-modal-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.mobile-modal-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 12px;
    transition: var(--transition-smooth);
}

.mobile-modal-close:hover,
.mobile-modal-close:active {
    background: rgba(245, 87, 108, 0.2);
    border-color: var(--accent-coral);
    color: var(--accent-coral);
}

.mobile-modal-body {
    padding: 0;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-modal-description {
    padding: 16px 20px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    border-top: 1px solid var(--glass-border);
}

/* ─── SECTION HEADER ─── */
.mobile-section-header {
    padding: 24px 16px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-primary);
}

/* ─── SHARED ANIMATIONS ─── */
@keyframes common-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes common-slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes common-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes common-toastPop {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ─── SAFE AREA ─── */
@supports (padding: max(0px)) {
    .mobile-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
}