/* AmiBroker AFL - Main Stylesheet */
/* Modern, Responsive, Dark/Light Theme Support */

/* Font fallback with size-adjust to prevent CLS */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: local('Inter'), local('Inter-Regular');
    size-adjust: 100%;
}

/* System font fallback with metrics matching Inter */
@font-face {
    font-family: 'Inter-fallback';
    src: local('Segoe UI'), local('Arial');
    size-adjust: 107%;
    ascent-override: 90%;
    descent-override: 22%;
    line-gap-override: normal;
}

:root {
    /* Light Theme Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --secondary-dark: #0284c7;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Light theme specific */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    --gradient-hero: linear-gradient(135deg, #4338ca 0%, #6366f1 50%, #7c3aed 100%);
    --hero-text-primary: #ffffff;
    --hero-text-secondary: rgba(255, 255, 255, 0.85);
    --hero-text-accent: #c7d2fe;
    --hero-btn-primary-bg: #ffffff;
    --hero-btn-primary-color: #4338ca;
    --hero-btn-secondary-border: rgba(255, 255, 255, 0.4);
    --hero-btn-secondary-color: #ffffff;
    --hero-code-bg: rgba(15, 23, 42, 0.85);
    --hero-code-border: rgba(255, 255, 255, 0.15);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Border radius */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 1000;
    --z-modal-backdrop: 9998;
    --z-modal: 9999;
    --z-tooltip: 10000;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    --border-color: #334155;
    
    --gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    --hero-text-primary: #ffffff;
    --hero-text-secondary: rgba(255, 255, 255, 0.8);
    --hero-text-accent: #a5b4fc;
    --hero-btn-primary-bg: #ffffff;
    --hero-btn-primary-color: #4338ca;
    --hero-btn-secondary-border: rgba(255, 255, 255, 0.3);
    --hero-btn-secondary-color: #ffffff;
    --hero-code-bg: rgba(0, 0, 0, 0.4);
    --hero-code-border: rgba(255, 255, 255, 0.1);
    --hero-badge-bg: rgba(255, 255, 255, 0.1);
    --hero-badge-border: rgba(255, 255, 255, 0.2);
    --border-light: #1e293b;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', 'Inter-fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition), color var(--transition);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-sm { max-width: 768px; }
.container-md { max-width: 1024px; }
.container-lg { max-width: 1280px; }
.container-xl { max-width: 1536px; }

/* Section Spacing */
.section {
    padding: var(--space-3xl) 0;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-title {
    margin-bottom: var(--space-sm);
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.section-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.5);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: var(--text-inverse); }

.btn-sm { padding: var(--space-xs) var(--space-md); font-size: 0.875rem; }
.btn-lg { padding: var(--space-md) var(--space-xl); font-size: 1.125rem; }
.btn-icon { padding: var(--space-sm); }
.btn-block { width: 100%; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-body {
    padding: var(--space-lg);
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.card-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* Flexbox Utilities */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Forms */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.table th,
.table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-primary);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--info); }

/* Alerts */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.alert-success { background: rgba(16, 185, 129, 0.1); color: var(--success); border-left: 4px solid var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border-left: 4px solid var(--warning); }
.alert-info { background: rgba(59, 130, 246, 0.1); color: var(--info); border-left: 4px solid var(--info); }

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

[data-theme="dark"] .loading-overlay {
    background: rgba(15, 23, 42, 0.9);
}

/* Pagination */
.pagination {
    display: flex;
    gap: var(--space-xs);
    justify-content: center;
    flex-wrap: wrap;
}

.pagination-item {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.pagination-item:hover {
    background: var(--bg-hover);
}

.pagination-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

.bg-primary { background-color: var(--primary) !important; }
.bg-secondary { background-color: var(--bg-secondary) !important; }
.bg-tertiary { background-color: var(--bg-tertiary) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-sm) !important; }
.mt-2 { margin-top: var(--space-md) !important; }
.mt-3 { margin-top: var(--space-lg) !important; }
.mt-4 { margin-top: var(--space-xl) !important; }
.mt-5 { margin-top: var(--space-2xl) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-sm) !important; }
.mb-2 { margin-bottom: var(--space-md) !important; }
.mb-3 { margin-bottom: var(--space-lg) !important; }
.mb-4 { margin-bottom: var(--space-xl) !important; }
.mb-5 { margin-bottom: var(--space-2xl) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--space-sm) !important; }
.p-2 { padding: var(--space-md) !important; }
.p-3 { padding: var(--space-lg) !important; }
.p-4 { padding: var(--space-xl) !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }

.rounded { border-radius: var(--radius) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.shadow { box-shadow: var(--shadow) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease forwards; }
.animate-fadeInDown { animation: fadeInDown 0.5s ease forwards; }
.animate-slideInLeft { animation: slideInLeft 0.5s ease forwards; }
.animate-slideInRight { animation: slideInRight 0.5s ease forwards; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-bounce { animation: bounce 2s infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* Scroll animations */
[data-aos] {
    opacity: 0;
    transition: all 0.6s ease;
}

[data-aos].aos-animate {
    opacity: 1;
}

[data-aos="fade-up"] {
    transform: translateY(30px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-down"] {
    transform: translateY(-30px);
}

[data-aos="fade-down"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-left"] {
    transform: translateX(30px);
}

[data-aos="fade-left"].aos-animate {
    transform: translateX(0);
}

[data-aos="fade-right"] {
    transform: translateX(-30px);
}

[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

[data-aos="zoom-in"] {
    transform: scale(0.9);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

/* Responsive Hide/Show */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}

@media (max-width: 1024px) {
    .hide-tablet { display: none !important; }
}

/* Print Styles */
@media print {
    .no-print { display: none !important; }
}

/* ==========================================
   MOBILE OPTIMIZATION - Comprehensive Fixes
   ========================================== */

/* Mobile Container */
@media (max-width: 640px) {
    .container {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }
    
    /* Reduce spacing on mobile */
    :root {
        --space-2xl: 2rem;
        --space-3xl: 2.5rem;
    }
}

/* Mobile Header Fixes */
@media (max-width: 768px) {
    .header-inner {
        height: 60px;
        padding: 0 var(--space-md);
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .logo-image {
        max-height: 35px;
    }
}

/* Mobile Navigation - Removed (handled in components.css) */

/* Mobile Hero Section */
@media (max-width: 768px) {
    .hero {
        padding-top: 80px;
        padding-bottom: 40px;
        min-height: auto;
    }
    
    .hero-content {
        padding: var(--space-md) 0;
    }
    
    .hero-badge {
        font-size: 0.75rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .hero-title {
        font-size: clamp(1.5rem, 7vw, 2.25rem);
        line-height: 1.2;
        margin-bottom: var(--space-md);
    }
    
    .hero-description {
        font-size: 0.9375rem;
        line-height: 1.7;
        margin-bottom: var(--space-lg);
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: var(--space-sm);
        width: 100%;
    }
    
    .hero-btn-primary,
    .hero-btn-secondary,
    .cta-btn-primary,
    .cta-btn-secondary {
        width: 100%;
        justify-content: center;
        padding: var(--space-md) var(--space-lg);
        font-size: 0.9375rem;
    }
    
    .hero-stats {
        flex-wrap: wrap;
        gap: var(--space-lg);
        margin-top: var(--space-xl);
    }
    
    .hero-stat-number {
        font-size: 1.75rem;
    }
    
    .hero-stat-label {
        font-size: 0.75rem;
    }
    
    .hero-visual {
        display: none;
    }
}

/* Mobile Section Spacing */
@media (max-width: 768px) {
    .section,
    .about-modern,
    .services,
    .advantages,
    .blog-preview,
    .afl-preview,
    .cta {
        padding: var(--space-2xl) 0;
    }
    
    .section-header {
        margin-bottom: var(--space-xl);
    }
    
    .section-title {
        font-size: clamp(1.5rem, 5vw, 2rem);
        line-height: 1.3;
    }
    
    .section-subtitle {
        font-size: 0.9375rem;
    }
    
    .section-badge {
        font-size: 0.75rem;
        padding: var(--space-xs) var(--space-sm);
    }
}

/* Mobile Grid Layouts */
@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .about-features-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .about-feature-card {
        padding: var(--space-lg);
    }
    
    .about-feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .about-feature-card h4 {
        font-size: 1rem;
    }
    
    .about-feature-card p {
        font-size: 0.875rem;
    }
    
    .about-stats-bar {
        flex-direction: column;
        gap: var(--space-md);
        padding: var(--space-lg);
    }
    
    .about-stat-divider {
        display: none;
    }
    
    .about-stat-number {
        font-size: 1.5rem;
    }
}

/* Mobile Service Cards */
@media (max-width: 768px) {
    .service-card {
        padding: var(--space-lg);
    }
    
    .service-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .service-title {
        font-size: 1.125rem;
    }
    
    .service-description {
        font-size: 0.875rem;
    }
}

/* Mobile Advantage Cards */
@media (max-width: 768px) {
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .advantage-card {
        padding: var(--space-md);
    }
    
    .advantage-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin-bottom: var(--space-sm);
    }
    
    .advantage-title {
        font-size: 0.875rem;
    }
    
    .advantage-description {
        font-size: 0.75rem;
        display: none;
    }
}

@media (max-width: 480px) {
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Blog/AFL Cards */
@media (max-width: 768px) {
    .blog-grid,
    .afl-preview-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .blog-card-image,
    .afl-preview-image {
        height: 180px;
    }
    
    .blog-card-content,
    .afl-preview-content {
        padding: var(--space-md);
    }
    
    .blog-card-title,
    .afl-preview-title {
        font-size: 1rem;
    }
    
    .blog-card-excerpt,
    .afl-preview-excerpt {
        font-size: 0.875rem;
    }
}

/* Mobile CTA Section */
@media (max-width: 768px) {
    .cta {
        padding: var(--space-2xl) 0;
    }
    
    .cta-title {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }
    
    .cta-description {
        font-size: 0.9375rem;
        padding: 0 var(--space-sm);
    }
    
    .cta-buttons {
        flex-direction: column;
        width: 100%;
        padding: 0 var(--space-md);
    }
    
    .cta-btn-primary,
    .cta-btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile Footer */
@media (max-width: 768px) {
    .footer {
        padding: var(--space-2xl) 0 var(--space-lg);
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        text-align: center;
    }
    
    .footer-brand {
        max-width: 100%;
    }
    
    .footer-logo {
        justify-content: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .footer-section h4 {
        margin-bottom: var(--space-md);
    }
    
    .footer-links {
        align-items: center;
    }
    
    .footer-links li {
        text-align: center;
    }
    
    .footer-bottom {
        padding-top: var(--space-md);
        margin-top: var(--space-lg);
    }
    
    .footer-copyright {
        font-size: 0.8125rem;
    }
}

/* Mobile Cards & Buttons */
@media (max-width: 768px) {
    .card {
        border-radius: var(--radius-md);
    }
    
    .card-body {
        padding: var(--space-md);
    }
    
    .btn {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: var(--space-md) var(--space-lg);
    }
}

/* Mobile Modal */
@media (max-width: 640px) {
    #contactModal .modal-dialog {
        margin: var(--space-sm);
        padding: var(--space-sm);
        min-height: auto;
    }
    
    #contactModal .modal-box {
        border-radius: var(--radius-lg);
    }
    
    #contactModal .modal-header {
        padding: var(--space-md);
    }
    
    #contactModal .modal-body {
        padding: var(--space-md);
    }
    
    #contactModal .form-row {
        gap: var(--space-sm);
    }
    
    #contactModal .form-group {
        margin-bottom: var(--space-sm);
    }
}

/* Touch-friendly improvements */
@media (max-width: 1024px) {
    /* Increase touch targets */
    .nav-link,
    .dropdown-item,
    .btn,
    .social-link,
    .footer-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Remove hover effects on touch devices */
    .card:hover,
    .service-card:hover,
    .blog-card:hover,
    .afl-preview-card:hover,
    .advantage-card:hover,
    .about-feature-card:hover {
        transform: none;
    }
}

/* Improve text readability on mobile */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }
    
    p, li, span {
        line-height: 1.6;
    }
}

/* Fix overflow issues */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }
    
    .container {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
    
    pre, code {
        overflow-x: auto;
        max-width: 100%;
    }
}

/* Back to top button mobile */
@media (max-width: 768px) {
    .back-to-top {
        width: 40px;
        height: 40px;
        right: var(--space-md);
        bottom: var(--space-md);
        font-size: 1rem;
    }
}

/* Preloader mobile */
@media (max-width: 768px) {
    .preloader-text {
        font-size: 0.875rem;
    }
}

/* Skip Link - Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    z-index: 10001;
    transition: top var(--transition);
}

.skip-link:focus {
    top: var(--space-sm);
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

/* Extra Small Screens (320px - 375px) */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }
    
    .hero-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero-description {
        font-size: 0.875rem;
    }
    
    .hero-btn-primary,
    .hero-btn-secondary {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.875rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .section-subtitle {
        font-size: 0.8125rem;
    }
    
    .btn {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.8125rem;
    }
    
    .card {
        padding: var(--space-sm);
    }
    
    .card-body {
        padding: var(--space-sm);
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1rem; }
    h4 { font-size: 0.9375rem; }
}

/* iPhone SE and similar small screens */
@media (max-width: 320px) {
    html {
        font-size: 13px;
    }
    
    .hero-badge {
        font-size: 0.6875rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .hero-title {
        font-size: 1.375rem;
    }
    
    .section-badge {
        font-size: 0.6875rem;
    }
    
    .nav-link {
        font-size: 0.8125rem;
        padding: var(--space-xs) var(--space-sm);
    }
}
