/* ========================================
   MYPINSPOT ADHD-OPTIMIZED DESIGN SYSTEM
   ======================================== */

/* ========= PREMIUM COLOR SYSTEM ========= */
:root {
    /* Primary - Sophisticated Purple (like Notion/Linear) */
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --primary-light: #a78bfa;
    --primary-bg: rgba(139, 92, 246, 0.08);
    --primary-hover: rgba(139, 92, 246, 0.12);
    
    /* Accent - Refined Blue */
    --accent: #6366f1;
    --accent-dark: #4f46e5;
    --accent-light: #818cf8;
    
    /* Backgrounds - Warm neutrals */
    --bg-main: #fafaf9;
    --bg-card: #ffffff;
    --bg-hover: #f5f5f4;
    --bg-elevated: #ffffff;
    
    /* Text - Professional hierarchy */
    --text-primary: #18181b;
    --text-secondary: #71717a;
    --text-tertiary: #a1a1aa;
    --text-disabled: #d4d4d8;
    
    /* Borders - Subtle */
    --border-light: #f4f4f5;
    --border-medium: #e4e4e7;
    --border-strong: #d4d4d8;
    
    /* Status colors */
    --success: #10b981;
    --success-bg: #d1fae5;
    --success-border: #6ee7b7;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --error: #ef4444;
    --error-bg: #fee2e2;
    
    /* Shadows - Elevation system */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Focus ring - Refined */
    --focus-ring: 0 0 0 3px rgba(139, 92, 246, 0.12);
    
    /* Spacing - Consistent 4px grid */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    
    /* Border radius - Modern */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
}

/* Dark mode is controlled via settings, not OS preference */

/* Professional Dark Mode - Material Design 3 + Apple HIG */
body.dark-mode,
html.dark-mode {
    /* Backgrounds - Warm dark (not pure black) */
    --bg-main: #1a1a1a;
    --bg-card: #262626;
    --bg-hover: #2d2d2d;
    --bg-elevated: #303030;
    
    /* Text - Proper contrast ratios */
    --text-primary: #fafafa;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;
    --text-disabled: #525252;
    
    /* Primary - Lighter purple for dark backgrounds */
    --primary: #a78bfa;
    --primary-dark: #c4b5fd;
    --primary-light: #8b5cf6;
    --primary-bg: rgba(167, 139, 250, 0.12);
    --primary-hover: rgba(167, 139, 250, 0.18);
    
    /* Accent */
    --accent: #818cf8;
    --accent-dark: #a5b4fc;
    --accent-light: #6366f1;
    
    /* Borders - Subtle in dark mode */
    --border-light: #2d2d2d;
    --border-medium: #3d3d3d;
    --border-strong: #525252;
    
    /* Status colors - Adjusted for dark */
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --success-border: #10b981;
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.12);
    
    /* Shadows - Deeper in dark mode */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    
    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

/* High contrast mode */
body.high-contrast,
html.high-contrast {
    --bg-main: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f0;
    --text-primary: #000000;
    --text-secondary: #000000;
    --text-tertiary: #333333;
    --primary: #0066cc;
    --primary-dark: #004499;
    --focus-ring: 0 0 0 4px rgba(0, 102, 204, 0.8);
}

body.high-contrast *,
html.high-contrast * {
    border-color: #000000 !important;
}

body.high-contrast .btn-adhd,
html.high-contrast .btn-adhd {
    border: 3px solid #000000;
    font-weight: 700;
}

/* Simplified view mode - aggressive simplification */
body.simplified-view,
html.simplified-view {
    --bg-main: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f9f9f9;
}

body.simplified-view .card-adhd,
html.simplified-view .card-adhd,
body.simplified-view .adhd-container,
html.simplified-view .adhd-container {
    box-shadow: none !important;
    border: 2px solid #d0d0d0 !important;
    background: white !important;
}

/* Hide all images and decorative elements */
body.simplified-view img:not([alt]),
html.simplified-view img:not([alt]),
body.simplified-view .item-photo-adhd img,
html.simplified-view .item-photo-adhd img {
    display: none !important;
}

/* Hide decorative SVGs but keep navigation and functional icons */
body.simplified-view .card-adhd svg:not(.w-4):not(.w-5):not(.w-6),
html.simplified-view .card-adhd svg:not(.w-4):not(.w-5):not(.w-6) {
    display: none !important;
}

/* Hide emoji and decorative icons */
body.simplified-view .item-photo-placeholder,
html.simplified-view .item-photo-placeholder {
    display: none !important;
}

/* Simplify FAB */
body.simplified-view .fab-adhd,
html.simplified-view .fab-adhd {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    background: #333 !important;
}

/* Remove gradients and effects */
body.simplified-view *,
html.simplified-view * {
    background-image: none !important;
    box-shadow: none !important;
}

/* Keep essential shadows */
body.simplified-view .btn-adhd:hover,
html.simplified-view .btn-adhd:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Simplify colors - high contrast */
body.simplified-view,
html.simplified-view {
    background: white !important;
}

body.simplified-view .btn-adhd,
html.simplified-view .btn-adhd {
    background: #000000 !important;
    color: white !important;
    border: 2px solid #000000 !important;
}

body.simplified-view .btn-adhd-secondary,
html.simplified-view .btn-adhd-secondary {
    background: white !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transform: none !important;
    }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after,
html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition: none !important;
}

body.reduce-motion .btn-adhd:hover,
html.reduce-motion .btn-adhd:hover,
body.reduce-motion .back-btn:hover,
html.reduce-motion .back-btn:hover,
body.reduce-motion .card-adhd:hover,
html.reduce-motion .card-adhd:hover {
    transform: none !important;
}

/* ========= BASE STYLES ========= */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Font size adjustments - affects everything */
html.font-size-small { font-size: 14px; }
html.font-size-medium { font-size: 16px; }
html.font-size-large { font-size: 18px; }
html.font-size-xlarge { font-size: 20px; }

body.font-size-small { font-size: 14px; }
body.font-size-medium { font-size: 16px; }
body.font-size-large { font-size: 18px; }
body.font-size-xlarge { font-size: 20px; }

/* Scale all text proportionally */
html.font-size-small body { font-size: 1em; }
html.font-size-medium body { font-size: 1em; }
html.font-size-large body { font-size: 1em; }
html.font-size-xlarge body { font-size: 1em; }

/* Ensure buttons, inputs, and all text scale */
html.font-size-small .btn-adhd,
html.font-size-small .btn-adhd-secondary,
html.font-size-small .btn-ghost,
html.font-size-small input,
html.font-size-small button,
html.font-size-small p,
html.font-size-small span,
html.font-size-small a { font-size: inherit; }

html.font-size-large .btn-adhd,
html.font-size-large .btn-adhd-secondary,
html.font-size-large .btn-ghost,
html.font-size-large input,
html.font-size-large button,
html.font-size-large p,
html.font-size-large span,
html.font-size-large a { font-size: 1.125em; }

html.font-size-xlarge .btn-adhd,
html.font-size-xlarge .btn-adhd-secondary,
html.font-size-xlarge .btn-ghost,
html.font-size-xlarge input,
html.font-size-xlarge button,
html.font-size-xlarge p,
html.font-size-xlarge span,
html.font-size-xlarge a { font-size: 1.25em; }

/* ========= TYPOGRAPHY ========= */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(28px, 5vw, 36px); }
h2 { font-size: clamp(24px, 4vw, 32px); }
h3 { font-size: clamp(20px, 3vw, 24px); }

p {
    margin: 0;
    line-height: 1.6;
}

/* ========= PREMIUM BUTTONS ========= */
.btn-adhd {
    /* Size - Touch-friendly */
    min-height: 44px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    
    /* Style */
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    
    /* Smooth transitions */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Primary style - Purple */
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
    
    /* Accessibility */
    outline: none;
}

.btn-adhd:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-adhd:focus-visible {
    box-shadow: var(--focus-ring), var(--shadow-md);
}

.btn-adhd:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-adhd:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Secondary button - Subtle */
.btn-adhd-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-sm);
}

.btn-adhd-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Ghost button - Minimal */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    min-height: 40px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Icon button */
.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon:focus-visible {
    box-shadow: var(--focus-ring);
    outline: none;
}

/* ========= PREMIUM INPUTS ========= */
.input-adhd {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: -0.01em;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: var(--shadow-sm);
}

.input-adhd::placeholder {
    color: var(--text-tertiary);
}

.input-adhd:hover {
    border-color: var(--border-strong);
}

.input-adhd:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring), var(--shadow-sm);
}

.input-adhd:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-hover);
}

/* ========= PREMIUM CARDS ========= */
.card-adhd {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.card-adhd:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-adhd-interactive {
    cursor: pointer;
}

.card-adhd-interactive:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* ========= LAYOUT HELPERS ========= */
.adhd-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-main);
}

.adhd-container {
    max-width: 500px;
    width: 100%;
}

/* ========= PROGRESS DOTS ========= */
.progress-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: all 0.2s;
}

.progress-dot.active {
    background: var(--primary);
    width: 32px;
    border-radius: 6px;
}

/* ========= PREMIUM FLOATING ACTION BUTTON ========= */
.fab-adhd {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.fab-adhd:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: var(--shadow-xl);
    background: var(--primary-dark);
}

.fab-adhd:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.fab-adhd svg {
    width: 24px;
    height: 24px;
    stroke: white;
    color: white;
}

/* ========= BACK BUTTON ========= */
.back-btn:hover {
    border-color: var(--primary) !important;
    transform: translateX(-4px);
}

.back-btn:active {
    transform: translateX(-2px);
}

/* ========= UTILITY CLASSES ========= */
.text-center { text-align: center; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

/* ========= TOGGLE SWITCH ========= */
.toggle-switch {
    position: relative;
    width: 56px;
    height: 32px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-tertiary);
    transition: 0.2s;
    border-radius: 32px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: var(--focus-ring);
}

/* ========= LOADING STATES ========= */
.loading-spinner {
    border: 3px solid var(--text-tertiary);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========= SUCCESS/ERROR MESSAGES ========= */
.message-adhd {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-success {
    background: var(--success-bg);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.message-error {
    background: var(--error-bg);
    color: var(--error);
    border-left: 4px solid var(--error);
}

/* ========= RESPONSIVE ========= */
@media (max-width: 640px) {
    .adhd-screen {
        padding: 16px;
    }
    
    .btn-adhd {
        min-height: 52px;
        font-size: 16px;
    }
    
    .input-adhd {
        min-height: 52px;
        font-size: 16px;
    }
}
