/* Global styles and CSS variables */

/* Import component styles */
@import url('./nav.css');
@import url('./hero.css');
@import url('./generator.css');
@import url('./features.css');
@import url('./utilities.css');

:root {
    /* ===== COLOR SYSTEM ===== */
    /* Base colors - Dark blue tech feel */
    --bg-deep: #0f172a;
    --bg-surface: #1e293b;
    --bg-elevated: #334155;
    --bg-main: var(--bg-deep);
    --bg-panel: var(--bg-surface);
    --bg-hover-active: #405067;
    --bg-input: var(--bg-elevated);
    
    /* Text colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    /* Brand colors - Blue tech feel */
    --neon-primary: #0096ff;
    --neon-secondary: #0066cc;
    --neon-accent: #00a8ff;
    --accent-primary: var(--neon-primary);
    --accent-secondary: var(--neon-secondary);
    --accent-tertiary: var(--neon-accent);
    
    /* Status colors */
    --status-success: #4dc790;
    --status-warning: #ff9f40;
    --status-error: #ff6384;
    --status-info: var(--neon-primary);
    
    /* Border colors */
    --border-primary: #4a5a70;
    --border-secondary: rgba(51, 65, 85, 0.3);
    --border-accent: rgba(0, 150, 255, 0.4);
    
    /* ===== SPACING SYSTEM ===== */
    /* Standard spacing variables used across the application */
    /* Follows a consistent progression based on 0.25rem increments */
    --space-xs: 0.25rem;   /* 1/4rem */
    --space-sm: 0.5rem;    /* 1/2rem */
    --space-md: 1rem;      /* 1rem */
    --space-lg: 1.5rem;    /* 1.5rem */
    --space-xl: 2rem;      /* 2rem */
    --space-2xl: 3rem;     /* 3rem */
    --space-3xl: 4rem;     /* 4rem */
    --space-4xl: 6rem;     /* 6rem */
    
    /* ===== MOBILE-FIRST SPACING SYSTEM ===== */
    /* Mobile-specific spacing variables for optimized mobile layouts */
    /* Follows a consistent progression with standard spacing but reduced values */
    --mobile-space-xs: 0.125rem;  /* 1/8rem */
    --mobile-space-sm: 0.25rem;   /* 1/4rem */
    --mobile-space-md: 0.5rem;    /* 1/2rem */
    --mobile-space-lg: 0.75rem;   /* 3/4rem */
    --mobile-space-xl: 1rem;      /* 1rem */
    --mobile-space-2xl: 1.5rem;   /* 1.5rem */
    --mobile-space-3xl: 2rem;     /* 2rem */
    --mobile-space-4xl: 3rem;     /* 3rem */
    
    /* ===== FLUID SPACING SYSTEM ===== */
    /* Fluid spacing variables that adapt to viewport width */
    /* Provides responsive spacing that scales between minimum and maximum values */
    --fluid-space-sm: clamp(0.25rem, 1vw, 0.5rem);
    --fluid-space-md: clamp(0.5rem, 2vw, 1rem);
    --fluid-space-lg: clamp(0.75rem, 3vw, 1.5rem);
    --fluid-space-xl: clamp(1rem, 4vw, 2rem);
    --fluid-space-2xl: clamp(1.5rem, 5vw, 3rem);
    --fluid-space-3xl: clamp(2rem, 6vw, 4rem);
    
    /* ===== TYPOGRAPHY ===== */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* ===== BORDER RADIUS ===== */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* ===== TRANSITIONS & ANIMATIONS ===== */
    --transition-fast: all 0.15s ease;
    --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s ease;
    
    /* ===== LAYOUT ===== */
    --navbar-height: 70px;
    --content-max-width: 1200px;
    --content-padding: clamp(1rem, 3vw, 2rem);
    
    /* ===== BREAKPOINTS ===== */
    --breakpoint-mobile: 768px;
    --breakpoint-tablet: 1024px;
    --breakpoint-desktop: 1200px;
    --breakpoint-mobile-sm: 375px;
    
    /* ===== EFFECTS ===== */
    --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);
    
    --glow-primary: 0 0 20px rgba(0, 150, 255, 0.3);
    --glow-secondary: 0 0 30px rgba(0, 102, 204, 0.4);
    --glow-accent: 0 0 25px rgba(0, 168, 255, 0.3);
    
    /* ===== Z-INDEX LAYERS ===== */
    --z-dropdown: 10;
    --z-sticky: 20;
    --z-fixed: 30;
    --z-modal: 40;
    --z-popover: 50;
    --z-tooltip: 60;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== RESPONSIVE GRID SYSTEM ===== */
.grid-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Content area safe boundaries */
.content-safe-area {
    max-width: min(var(--content-max-width), 98vw);
    margin: 0 auto;
    padding: 0 1.5rem; /* Fallback for older browsers */
    padding: 0 clamp(0.75rem, 3vw, 2rem);
    width: 100%;
}

/* ===== MOBILE-FIRST CONTENT SAFE AREA ===== */
/* Enhanced fluid spacing for better mobile experience */
@media (max-width: var(--breakpoint-mobile)) {
    .content-safe-area {
        padding: 0 clamp(0.5rem, 2.5vw, 1.5rem);
        max-width: 100vw;
    }
}

/* Extra small mobile devices */
@media (max-width: var(--breakpoint-mobile-sm)) {
    .content-safe-area {
        padding: 0 clamp(0.375rem, 2vw, 1rem);
    }
}

/* ===== BASE STYLES ===== */
body {
    background-color: var(--bg-main);
    color: var(--text-secondary);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--font-size-md);
    line-height: var(--line-height-normal);
    font-weight: var(--font-weight-normal);
    overflow-x: hidden;
    padding-top: var(--navbar-height);
}

/* Page wrapper */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--navbar-height));
    contain: layout;
}

/* Main content area */
.main-content {
    flex: 1;
    padding: clamp(1.5rem, 5vw, 3rem) 0 clamp(1.5rem, 5vw, 3rem);
    contain: layout;
}

/* Remove old container styles - replaced by generator cards */

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-md);
}

h1 {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--space-sm);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

.subtitle {
    color: var(--text-muted);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

/* ===== FORM ELEMENTS ===== */
label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Remove fieldset default border */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

fieldset legend {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-md);
    padding: 0;
}

/* Input fields */
textarea, input[type="text"] {
    width: 100%;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    resize: vertical;
    transition: var(--transition-normal);
    font-family: inherit;
}

textarea:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

/* Form elements - basic styles only, card-specific styles in components.css */

/* Output area - simplified styles for new card layout */

/* Notification */
.notification {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition-normal);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    border-left: 4px solid var(--status-success);
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.error {
    border-left-color: var(--status-error);
}

.notification.info {
    border-left-color: var(--status-info);
}

.notification svg {
    margin-right: var(--space-md);
    width: 20px;
    height: 20px;
}

/* Footer */
footer {
    margin-top: var(--space-2xl);
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    padding: var(--space-lg) 0;
}

/* About section with card-style design */
.about-section {
    padding: var(--space-2xl) 0;
    background: var(--bg-main);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.about-section .container {
    max-width: 900px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
    margin: 0 auto;
}

/* SEO content */
.seo-content {
    margin-top: var(--space-2xl);
    padding: var(--space-lg);
    background: rgba(51, 65, 85, 0.3);
    border-radius: var(--radius-md);
    border: 1px solid rgba(74, 90, 112, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.seo-content h2 {
    color: var(--accent-primary);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-2xl);
}

.seo-content p {
    margin-bottom: var(--space-md);
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
}

/* FAQ section */
.faq-section {
    margin-top: var(--space-xl);
}

.faq-item {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: rgba(51, 65, 85, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(74, 90, 112, 0.3);
    transition: var(--transition-normal);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.faq-item:hover {
    background: rgba(51, 65, 85, 0.4);
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-question {
    font-weight: var(--font-weight-semibold);
    color: var(--accent-primary);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-lg);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: var(--breakpoint-mobile)) {
    .notification {
        right: clamp(0.5rem, 2.5vw, 1rem);
        bottom: clamp(0.5rem, 2.5vw, 1rem);
        left: clamp(0.5rem, 2.5vw, 1rem);
        max-width: calc(100vw - clamp(0.5rem, 2.5vw, 1rem) * 2);
        padding: clamp(0.75rem, 3vw, 1rem) clamp(1rem, 4vw, 1.5rem);
        font-size: clamp(0.875rem, 3vw, 1rem);
    }
    
    /* Mobile navigation bar optimization */
    .nav-container {
        padding: 0 clamp(0.5rem, 2.5vw, 1rem);
    }
    
    /* Mobile main content area optimization */
    .main-content {
        padding: 1.5rem 0 1.5rem; /* Fallback for older browsers */
        padding: clamp(1rem, 4vw, 2rem) 0 clamp(1rem, 4vw, 2rem);
    }
    
    /* Enhanced mobile typography scaling */
    h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        margin-bottom: clamp(0.5rem, 2vw, 1rem);
    }
    
    h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        margin-bottom: clamp(0.5rem, 2vw, 1rem);
    }
    
    h3 {
        font-size: clamp(1.25rem, 4vw, 1.75rem);
        margin-bottom: clamp(0.375rem, 1.5vw, 0.75rem);
    }
    
    .subtitle {
        font-size: clamp(1rem, 3.5vw, 1.25rem);
        line-height: 1.4;
    }
}

/* ===== ACCESSIBILITY & FOCUS MANAGEMENT ===== */
/* Skip to content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--accent-primary);
    color: white;
    padding: var(--space-sm);
    text-decoration: none;
    border-radius: var(--radius-sm);
    z-index: var(--z-modal);
    transition: top var(--transition-fast);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.skip-link:focus {
    top: 6px;
}

/* Enhanced focus states for all interactive elements */
*:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Remove default outline and add custom focus styles */
button:focus,
input:focus,
textarea:focus,
[role="button"]:focus,
[tabindex]:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.2);
}

/* Enhanced button focus states */
button:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.3), var(--shadow-md);
}

/* Keyboard-only focus styles */
.copy-btn:focus-visible {
    background: rgba(0, 212, 255, 0.1);
    transform: scale(1.1);
}

/* Enhanced checkbox focus */
input[type="checkbox"]:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.2);
}

/* Range slider focus */
input[type="range"]:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
}

input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.3), var(--shadow-md);
    transform: scale(1.3);
}

/* Label focus when associated input is focused */
input:focus + label,
input:focus ~ label {
    color: var(--accent-primary);
}

/* Tooltip focus styles */
.tooltip:focus .tooltip-text,
.tooltip:focus-within .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Card focus styles for keyboard navigation */
.card:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2), var(--shadow-xl);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-primary: #ffffff;
        --text-muted: #cccccc;
    }
    
    *:focus {
        outline: 3px solid #ffffff;
        outline-offset: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .checkbox-item:hover {
        transform: none;
    }
    
    button:focus-visible {
        transform: none;
    }
    
    .nav-link:hover {
        transform: none;
    }
}

/* Focus indicator for screen readers */
.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;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Animation for loading state */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ===== SHARED CARD COMPONENT ===== */
.card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
}

/* ===== CARD MODIFIERS ===== */
/* Generator card specific styles */
.card--generator {
    border-radius: var(--radius-lg);
    padding: 0;
}

.card--generator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
    background-size: 300% 100%;
    animation: borderFlow 3s linear infinite;
}

.card--generator:hover {
    box-shadow: 
        var(--shadow-xl),
        0 0 30px rgba(0, 212, 255, 0.2),
        0 0 60px rgba(168, 85, 247, 0.1);
    border-color: rgba(0, 212, 255, 0.5);
}

/* Feature card specific styles */
.card--feature {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-secondary);
    padding: var(--space-xl);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card--feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 150, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.card--feature:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow-secondary);
    border-color: rgba(0, 102, 204, 0.6);
}

.card--feature:hover::before {
    left: 100%;
}

/* ===== SHARED ANIMATIONS ===== */
@keyframes borderFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 300% 0%; }
}

/* Better focus management for modal-like elements */
.notification:focus {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 2px;
}