/**
 * Core Styles - Base resets, typography, utilities, animations
 * File: assets/css/core.css
 */

/* ========== CSS VARIABLES ========== */
:root {
    /* Spacing Scale (4px base) */
    --space-2xs: 0.125rem;  /* 2px */
    --space-xs: 0.25rem;    /* 4px */
    --space-xs-plus: 0.375rem; /* 6px */
    --space-sm: 0.5rem;     /* 8px */
    --space-sm-plus: 0.625rem; /* 10px */
    --space-md-minus: 0.75rem; /* 12px */
    --space-md: 1rem;       /* 16px */
    --space-lg: 1.5rem;     /* 24px */
    --space-xl: 2rem;       /* 32px */
    --space-2xl: 3rem;      /* 48px */
    
    /* Colors - Backgrounds */
    --bg-white: #ffffff;
    --bg-gray-50: #f9fafb;
    --bg-gray-100: #f3f4f6;
    --bg-gray-200: #e5e7eb;
    
    /* Colors - Text */
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-tertiary: #a0aec0;
    
    /* Colors - Borders */
    --border-gray: #e2e8f0;
    --border-gray-dark: #cbd5e0;
    
    /* Colors - Brand */
    --primary: #6b46c1;
    --primary-hover: #805ad5;
    --btn-primary: #6b46c1;
    --btn-primary-hover: #805ad5;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    
    /* Font Sizes */
    --text-xs: 0.6875rem;   /* 11px */
    --text-sm: 0.8125rem;   /* 13px */
    --text-base: 0.875rem;  /* 14px */
    --text-md: 1rem;        /* 16px */
    --text-lg: 1.125rem;    /* 18px */
    --text-xl: 1.25rem;     /* 20px */
    
    /* Sidebar Card Headers - Seasonal/Themeable */
    --sidebar-header-bg: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    --sidebar-header-text: #2d3748;
    --sidebar-header-icon: #4a5568;
    --sidebar-header-border: #cbd5e0;
    
    /* Section Headers (category groups, etc.) - Seasonal/Themeable */
    --section-header-bg: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    --section-header-text: #2d3748;
    --section-header-border: #cbd5e0;
    
    /* Accent Colors - Default (Autumn Orange) - Override in seasonal-theme.css */
    --ott-accent: #f6ad55;
    --ott-accent-hover: #ed8936;
    --ott-accent-dark: #dd6b20;
    --ott-accent-light: #feebc8;
    --ott-accent-text: #744210;           /* Text ON light accent backgrounds */
    --ott-accent-btn-text: #1a1a1a;       /* Text ON accent buttons */
    --ott-accent-rgb: 246, 173, 85;
    
    /* Status Colors */
    --color-success: #48bb78;
    --color-success-dark: #38a169;
    --color-success-light: #c6f6d5;
    --color-success-bg: #f0fff4;
    --color-success-text: #22543d;
    
    --color-error: #e53e3e;
    --color-error-dark: #c53030;
    --color-error-light: #fed7d7;
    --color-error-bg: #fff5f5;
    --color-error-text: #742a2a;
    
    --color-warning: #ed8936;
    --color-warning-dark: #dd6b20;
    --color-warning-light: #feebc8;
    --color-warning-bg: #fffaf0;
    --color-warning-text: #7c2d12;
    
    --color-info: #3182ce;
    --color-info-dark: #2c5282;
    --color-info-light: #bee3f8;
    --color-info-bg: #ebf8ff;
    --color-info-text: #1a365d;
    
    /* Card Backgrounds - Seasonal/Themeable */
    --card-bg: #ffffff;
    --card-bg-alt: #fafafa;
    --card-bg-highlight: #f7f7f7;
}

/* ========== RESET & BASE ========== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #2d3748;
    background: #f7fafc;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Large UI Mode - Optional accessibility mode */
body.large-ui {
    font-size: 18px;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.95rem; }

/* Large UI Mode - Bigger headings */
body.large-ui h1 { font-size: 2.5rem; }
body.large-ui h2 { font-size: 2rem; }
body.large-ui h3 { font-size: 1.5rem; }
body.large-ui h4 { font-size: 1.25rem; }
body.large-ui h5 { font-size: 1.1rem; }
body.large-ui h6 { font-size: 1rem; }

p {
    margin-bottom: 1em;
}

a {
    color: #6b46c1;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========== UTILITY CLASSES ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }
.ml-3 { margin-left: 1.5rem; }
.ml-4 { margin-left: 2rem; }

.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }
.mr-3 { margin-right: 1.5rem; }
.mr-4 { margin-right: 2rem; }

.mx-auto { margin-left: auto; margin-right: auto; }

.p-4 { padding: 2rem; }

.hidden { display: none !important; }
.show { display: block !important; }
.visually-hidden { 
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ========== FLEX UTILITIES ========== */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========== WIDTH UTILITIES ========== */
.w-full { width: 100%; }

/* ========== TEXT UTILITIES ========== */
.text-muted { color: #718096; }
.text-dark { color: #2d3748; }
.text-danger { color: #e53e3e; }
.text-success { color: #22543d; }
.text-purple { color: #6b46c1; }
.text-sm { font-size: 0.875rem; }
.font-semibold { font-weight: 600; }

/* ========== LINE HEIGHT ========== */
.leading-relaxed { line-height: 1.6; }

/* ========== GRID UTILITIES ========== */
.grid {
    display: grid;
    gap: 1rem;
}

/* ========== ANIMATIONS (Single Source) ========== */

/* Modal animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}

@keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* General animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spinner / Loading */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Feedback animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes closeBtnPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ========== ANIMATION UTILITY CLASSES ========== */
.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

/* ========== MODAL ANIMATION BINDINGS ========== */
.modal-overlay,
.ott-modal-overlay,
.subscription-modal,
.search-modal,
#contactModal,
#search-modal,
.filter-modal {
    animation: modalFadeIn 0.3s ease-out;
}

.modal-overlay.closing,
.ott-modal-overlay.closing,
.subscription-modal.closing,
.search-modal.closing,
#contactModal.closing,
#search-modal.closing,
.filter-modal.closing {
    animation: modalFadeOut 0.3s ease-out;
}

.modal-content,
.modal-container,
.ott-modal,
.filter-modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

.modal-content.closing,
.modal-container.closing,
.ott-modal.closing,
.filter-modal-content.closing {
    animation: modalSlideOut 0.3s ease-out;
}

/* Close button pulse */
.modal-close,
.modal-close-btn,
.close-modal-btn,
.ott-modal-close,
button.modal-close {
    animation: closeBtnPulse 2s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover,
.modal-close-btn:hover,
.close-modal-btn:hover,
.ott-modal-close:hover,
button.modal-close:hover,
.modal-close:focus,
.modal-close-btn:focus,
.close-modal-btn:focus,
.ott-modal-close:focus,
button.modal-close:focus {
    animation: none;
    transform: scale(1.2) rotate(90deg);
}

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

/* ========== ICON POSITIONING ========== */
.ott-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.ott-icon.icon-inline,
.ott-icon.icon-baseline {
    vertical-align: baseline;
    transform: translateY(0.15em);
}

.ott-icon.icon-center,
.ott-icon.icon-centered {
    vertical-align: middle;
    transform: translateY(0);
}

.ott-icon.icon-top {
    vertical-align: top;
}

.ott-icon.icon-text-top {
    vertical-align: text-top;
}

.ott-icon.icon-bottom {
    vertical-align: bottom;
}

/* Icon spacing */
.ott-icon.icon-mr-xs { margin-right: 0.25rem; }
.ott-icon.icon-mr-sm { margin-right: 0.5rem; }
.ott-icon.icon-mr { margin-right: 0.75rem; }
.ott-icon.icon-mr-lg { margin-right: 1rem; }

.ott-icon.icon-ml-xs { margin-left: 0.25rem; }
.ott-icon.icon-ml-sm { margin-left: 0.5rem; }
.ott-icon.icon-ml { margin-left: 0.75rem; }
.ott-icon.icon-ml-lg { margin-left: 1rem; }

/* Loader icon */
.ott-icon-loader {
    animation: spin 1s linear infinite;
}
