/* ==================== CSS VARIABLES (DESIGN SYSTEM) ==================== */
:root {
    /* Brand Colors - Updated Design System */
    --color-primary: #5B7FFF;
    --color-secondary: #6B46C1;
    --color-accent: #2196f3;
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-danger: #dc3545;
    
    /* Brand Colors with Alpha Variants - Updated */
    --color-primary-10: rgba(91, 127, 255, 0.1);
    --color-primary-15: rgba(91, 127, 255, 0.15);
    --color-primary-20: rgba(91, 127, 255, 0.2);
    --color-primary-30: rgba(91, 127, 255, 0.3);
    --color-primary-40: rgba(91, 127, 255, 0.4);
    --color-primary-35: rgba(91, 127, 255, 0.35);
    --color-secondary-10: rgba(107, 70, 193, 0.1);
    --color-success-20: rgba(40, 167, 69, 0.2);
    --color-danger-20: rgba(220, 53, 69, 0.2);
    --color-primary-05: rgba(102, 126, 234, 0.05);
    
    /* Text Colors */
    --color-text-primary: #2c3e50;
    --color-text-secondary: #4a5568;
    --color-text-muted: #6c757d;
    --color-text-light: #718096;
    
    /* Background Colors */
    --color-bg-primary: #f8f9fa;
    
    /* Header White Theme Colors */
    --color-header-bg: #ffffff;
    --color-header-text: #2c3e50;
    --color-header-shadow: rgba(0, 0, 0, 0.08);
    --color-header-border: #e8e8e8;
    --color-bg-white: #ffffff;
    --color-bg-light: #f8fafc;
    --color-bg-muted: #e9ecef;
    
    /* Border Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 50%;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Font Sizes */
    --font-xs: 0.75rem;
    --font-sm: 0.85rem;
    --font-md: 1rem;
    --font-lg: 1.2rem;
    --font-xl: 1.5rem;
    --font-2xl: 2rem;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 15px var(--color-primary-15);
    --shadow-lg: 0 8px 30px var(--color-primary-30);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-active-tab: 0 8px 25px var(--color-primary-40);
    
    /* Transitions */
    --transition-fast: all 0.2s ease;
    --transition-normal: all 0.3s ease;
    --transition-slow: all 0.4s ease;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    --gradient-light: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
    --gradient-warning: linear-gradient(135deg, #fff8e1 0%, #fff3cd 100%);
    
    /* Z-Index */
    --z-dropdown: 1000;
    --z-overlay: 2000;
    --z-modal: 3000;
    
    /* Breakpoints (2024 responsive design standards) */
    --bp-mobile: 320px;     /* iPhone SE and minimum width */
    --bp-mobile-max: 767px; /* Maximum mobile width */
    --bp-tablet: 768px;     /* iPad and tablets */
    --bp-tablet-max: 1023px; /* Maximum tablet width */
    --bp-desktop: 1024px;   /* Laptops and desktops */
    --bp-wide: 1200px;      /* Large desktop screens */
}

/* Browser compatibility resets and universal styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-box-sizing: border-box; /* Safari/Chrome */
    -moz-box-sizing: border-box;    /* Firefox */
    -ms-box-sizing: border-box;     /* IE/Edge */
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: var(--color-bg-primary);
    -webkit-font-smoothing: antialiased; /* Safari/Chrome */
    -moz-osx-font-smoothing: grayscale;   /* Firefox on macOS */
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    padding-top: 80px; /* Space for fixed header */
}

/* Accessibility - Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: var(--radius-xs);
    -webkit-border-radius: var(--radius-xs);
    -moz-border-radius: var(--radius-xs);
}

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

/* Screen reader only content */
.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;
}

/* Keyboard navigation enhancement */
.keyboard-navigation button:focus,
.keyboard-navigation input:focus,
.keyboard-navigation a:focus {
    outline: 3px solid var(--color-accent); /* Updated to blue */
    outline-offset: 2px;
}

/* Header styles with cross-browser gradients - Updated Design System 2025 */
.site-header {
    background: var(--color-header-bg);
    color: var(--color-header-text);
    text-align: center;
    padding: 1.5rem 1rem; /* Increased for better spacing */
    border-bottom: 1px solid var(--color-header-border);
    -webkit-box-shadow: 0 2px 10px var(--color-header-shadow); /* Safari/Chrome */
    -moz-box-shadow: var(--shadow-lg);    /* Firefox */
    box-shadow: var(--shadow-lg);         /* Standard */
}

.site-header h1 {
    font-size: clamp(1.2rem, 4vw, 2.2rem); /* Responsive typography with clamp() */
    margin-bottom: 0.5rem; /* Increased for better spacing */
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3); /* Added text shadow for depth */
    /* Prevent text selection issues in Safari */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.subtitle {
    font-size: clamp(0.8rem, 2.5vw, 1rem); /* Responsive subtitle typography */
    opacity: 0.95;
    font-weight: 400; /* Increased for better readability */
    max-width: 600px;
    margin: 0 auto;
}

/* Hero section with decorative pattern overlay */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255,255,255,0.05) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

/* Hero section - unified header style for all pages */
.hero-section {
    background: linear-gradient(-45deg, #5B7FFF, #6B46C1, #2196f3, #5B7FFF);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: white;
    text-align: center;
    padding: 2.5rem 1rem; /* Reduced padding for smaller height */
    min-height: 200px; /* Reduced minimum height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    -webkit-box-shadow: 0 4px 20px rgba(91, 127, 255, 0.25);
    -moz-box-shadow: 0 4px 20px rgba(91, 127, 255, 0.25);
    box-shadow: 0 4px 20px rgba(91, 127, 255, 0.25);
}

/* Animated gradient effect */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Webkit support for Safari */
@-webkit-keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Unified hero section text styles for all pages */
.hero-section h1,
.hero-section h2 {
    font-size: clamp(2rem, 5vw, 3rem); /* Adjusted font size for smaller hero */
    margin-bottom: 0.6rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 2;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    line-height: 1.2;
}

.hero-section .subtitle,
.hero-section .article-meta {
    font-size: clamp(1.1rem, 3vw, 1.4rem); /* Adjusted font size for smaller hero */
    opacity: 0.9;
    font-weight: 400;
    max-width: 800px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 5px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2;
    line-height: 1.4;
}

/* Main content - simplified centered layout */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(0.5rem, 2vw, 1rem); /* Responsive padding with clamp() */
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

/* Calculator section */
.calculator-section {
    background: white;
    border-radius: var(--radius-xl); /* Increased for modern look */
    -webkit-border-radius: var(--radius-xl);
    -moz-border-radius: var(--radius-xl);
    -webkit-box-shadow: 0 8px 30px var(--color-primary-15);
    -moz-box-shadow: 0 8px 30px var(--color-primary-15);
    box-shadow: 0 8px 30px var(--color-primary-15);
    border: 1px solid var(--color-primary-10); /* Added subtle border */
    overflow: hidden;
    margin-bottom: 2rem; /* Increased for better spacing */
}

.calculator-container {
    padding: 2rem; /* Increased for better breathing room */
}

/* Calculator navigation with flexbox */
.calculator-nav {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    margin-bottom: 1.5rem; /* Increased for better spacing */
    background: #f8f9ff; /* Light background for contrast */
    border-radius: var(--radius-lg); /* Rounded container */
    -webkit-border-radius: var(--radius-lg);
    -moz-border-radius: var(--radius-lg);
    padding: 0.5rem; /* Added padding around tabs */
    /* Safari-specific fixes */
    -webkit-flex-wrap: nowrap;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    width: 100%;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    border-bottom: none;
    justify-content: center;
    gap: 0.25rem; /* Small gap between tabs */
}

.calc-tab {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -moz-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    background: var(--color-bg-white);
    border: 2px solid transparent;
    padding: 0.8rem 1rem;
    min-height: 48px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    -webkit-transition: var(--transition-normal);
    -moz-transition: var(--transition-normal);
    -ms-transition: var(--transition-normal);
    -o-transition: var(--transition-normal);
    transition: var(--transition-normal);
    /* Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Enhanced focus styles for accessibility */
    outline: none;
    /* Safari-specific button fixes */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    -webkit-flex-shrink: 1;
    -ms-flex-negative: 1;
    flex-shrink: 1;
    position: relative;
}

.calc-tab:hover {
    background: var(--color-bg-light);
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--color-primary-20);
}

.calc-tab:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.calc-tab.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    transform: translateY(0);
    box-shadow: 0 4px 12px var(--color-primary-30);
}

.calc-tab.active:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Calculator styles */
.calculator {
    margin-bottom: 0.5rem; /* Reduced from 1rem */
}

.calculator h2 {
    color: var(--color-text-primary);
    margin-bottom: 1.5rem; /* Increased for better spacing */
    font-size: clamp(1rem, 3vw, 1.5rem); /* Responsive calculator title typography */
    font-weight: 600;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--color-primary); /* Added accent border */
    display: inline-block;
    width: 100%;
}

/* Calculator input layout moved to new responsive section below */

.input-group {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 0.5rem; /* Increased for better spacing */
}

.input-group label {
    font-weight: 600;
    color: var(--color-text-primary); /* Updated to match legal pages */
    font-size: 1rem; /* Increased for better readability */
}

.input-group input {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    -webkit-border-radius: var(--radius-md);
    -moz-border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-family: inherit;
    background: var(--color-bg-white);
    min-height: 48px;
    width: 100%;
    box-sizing: border-box;
    -webkit-transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -moz-transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -ms-transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -o-transition: border-color 0.3s ease, box-shadow 0.3s ease;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    /* Remove default appearance in Safari */
    -webkit-appearance: none;
    -moz-appearance: textfield; /* Firefox */
    appearance: none; /* Standard property for compatibility */
    /* Enhanced accessibility */
    outline: none;
}

/* Remove spinner in Chrome, Safari, Edge */
.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hover state for better interactivity */
.input-group input:hover:not(:focus) {
    border-color: var(--color-primary-30);
    background: var(--color-bg-light);
    -webkit-box-shadow: 0 0 0 1px var(--color-primary-05);
    -moz-box-shadow: 0 0 0 1px var(--color-primary-05);
    box-shadow: 0 0 0 1px var(--color-primary-05);
}

/* Enhanced focus styles for better accessibility */
.input-group input:focus {
    border-color: var(--color-primary);
    background: #fafbff;
    -webkit-box-shadow: 0 0 0 4px var(--color-primary-15);
    -moz-box-shadow: 0 0 0 4px var(--color-primary-15);
    box-shadow: 0 0 0 4px var(--color-primary-15);
}

/* Error state styling */
.input-group input:invalid:not(:placeholder-shown) {
    border-color: var(--color-danger);
    -webkit-box-shadow: 0 0 0 3px var(--color-danger-20);
    -moz-box-shadow: 0 0 0 3px var(--color-danger-20);
    box-shadow: 0 0 0 3px var(--color-danger-20);
}

/* Valid state styling - unified with primary theme */
.input-group input:valid:not(:placeholder-shown) {
    border-color: var(--color-primary);
    -webkit-box-shadow: 0 0 0 1px var(--color-primary-10);
    -moz-box-shadow: 0 0 0 1px var(--color-primary-10);
    box-shadow: 0 0 0 1px var(--color-primary-10);
}

/* Results section - Enhanced animations */
.result {
    background: white;
    border: 1px solid var(--color-primary-20);
    padding: 1.2rem; /* Increased for better prominence */
    border-radius: var(--radius-lg); /* Increased for modern look */
    -webkit-border-radius: var(--radius-lg);
    -moz-border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px var(--color-primary-10);
    margin-top: 1rem; /* Increased for better spacing */
    border-left: 4px solid var(--color-primary); /* Updated to theme color */
    font-size: 1rem;
    transition: var(--transition-smooth);
    transform: translateY(0);
}

.result.updated {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--color-primary-30);
    background: linear-gradient(135deg, #f8f9ff 0%, #e8efff 100%);
    animation: resultHighlight 0.5s ease-out;
}

@keyframes resultHighlight {
    0% {
        border-left-color: var(--color-primary);
        transform: translateY(0);
    }
    50% {
        border-left-color: var(--color-secondary);
        transform: translateY(-3px);
    }
    100% {
        border-left-color: var(--color-primary);
        transform: translateY(-2px);
    }
}

.result-label {
    font-weight: 600;
    color: var(--color-text-primary); /* Updated to match legal pages */
    margin-right: 1rem;
    display: inline-block;
}

.result-value {
    font-size: 1.4rem; /* Increased for better prominence */
    font-weight: 700;
    color: var(--color-primary); /* Updated to theme color */
    display: inline-block;
}

/* Live Answer section - Enhanced animations */
.live-answer {
    background: var(--color-bg-white);
    border: 2px solid var(--color-primary-20);
    border-radius: var(--radius-lg);
    -webkit-border-radius: var(--radius-lg);
    -moz-border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    transition: var(--transition-normal)-out;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(0) scale(1);
    position: relative;
    overflow: hidden;
    text-align: center;
    min-height: 90px;
}

.live-answer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transition: left 0.6s ease-out;
    z-index: 1;
}



/* Answer content container */
.answer-content {
    width: 100%;
}

/* Main answer styling - highlighted primary result */
.main-answer {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
    display: block;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

/* Formula styling - secondary information */
.formula {
    font-size: 0.85rem;
    font-weight: 400;
    color: #666;
    display: block;
    line-height: 1.3;
    margin-top: 0.3rem;
}

/* Enhanced animation for live updates with reduced bounce effect */
.live-answer.updated {
    background: var(--gradient-light);
    border-color: var(--color-primary);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(91, 127, 255, 0.25);
    animation: answerPulse 0.4s ease-out;
}

.live-answer.updated::before {
    left: 100%; /* Sweep effect */
}

.live-answer.updated .main-answer {
    color: var(--color-secondary);
    text-shadow: 0 1px 3px rgba(107, 70, 193, 0.2);
    animation: textGlow 0.8s ease-out;
}

/* Keyframe animations for subtle effects */
@keyframes answerPulse {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 15px var(--color-primary-10);
    }
    50% {
        transform: translateY(-3px) scale(1.03);
        box-shadow: 0 8px 22px rgba(255, 152, 0, 0.3), 0 0 0 2px rgba(255, 152, 0, 0.2);
    }
    100% {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 6px 20px rgba(255, 152, 0, 0.25), 0 0 0 2px rgba(255, 152, 0, 0.15);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 1px 3px rgba(230, 81, 0, 0.3);
    }
    50% {
        text-shadow: 0 2px 8px rgba(230, 81, 0, 0.6), 0 0 15px rgba(255, 152, 0, 0.4);
    }
}

/* Educational Section */
.educational-section {
    background: var(--color-bg-light);
    padding: var(--space-2xl) var(--space-md);
    margin-top: var(--space-2xl);
    border-top: 1px solid var(--color-bg-muted);
}

.educational-section .container {
    max-width: 1200px;
    margin: 0 auto;
}

.educational-section h2 {
    text-align: center;
    color: var(--color-text-primary);
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.section-description {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xl);
    font-size: 1.1rem;
}

.educational-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.educational-card {
    background: var(--color-bg-white);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    border: 1px solid transparent;
}

.educational-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary-20);
}

.card-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: var(--space-md);
}

.educational-card h3 {
    color: var(--color-text-primary);
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.educational-card p {
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0;
}

.faq-link {
    text-align: center;
}

.btn-secondary {
    display: inline-block;
    padding: var(--space-md) var(--space-xl);
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Footer */
.site-footer {
    background: #343a40;
    color: white;
    text-align: center;
    padding: 0.35rem; /* Reduced from 0.7rem */
    margin-top: 0; /* Remove margin since educational section has its own spacing */
}

.footer-content p {
    margin: 0.1rem 0; /* Reduced from 0.2rem */
    opacity: 0.8;
    font-size: 0.85rem; /* Smaller text from 0.9rem */
}


/* ============== TABLET DEVICES (768px - 1023px) ============== */
@media screen and (max-width: 768px) {
    /* Flexbox optimization for mobile */
    .calc-inputs .input-group {
        flex: 1 1 120px;
        min-width: 120px;
    }
    
    /* Mobile Header Optimization */
    .site-header {
        padding: 1.2rem 0.5rem;
    }
    
    .hero-section {
        padding: 2rem 0.5rem;
        min-height: 180px; /* Reduced height for tablets */
        background-size: 600% 600%;
        animation: gradientShift 20s ease infinite;
    }
    
    .hero-section h1,
    .hero-section h2 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-section .subtitle,
    .hero-section .article-meta {
        font-size: 1.1rem;
    }
    
    .calculator-section {
        margin: 0.2rem 0; /* Further reduced from 0.25rem (20% reduction) */
        border-radius: var(--radius-md); /* Slightly smaller radius */
    }
    
    .calculator-container {
        padding: 1rem;
        margin: 0 0.5rem;
    }
    
    .calculator-nav {
        margin-bottom: 0.2rem; /* Further reduction */
    }
    
    .calc-tab {
        padding: 0.6rem 0.4rem;
        font-size: 0.85rem;
        min-height: 48px;
        border-radius: var(--radius-sm);
    }
    
    .calculator h2 {
        font-size: 0.9rem; /* Reduced from 1rem */
        margin-bottom: 0.25rem; /* Reduced from 0.5rem */
    }
    
    
    .input-group {
        gap: 0.1rem; /* Further reduction */
    }
    
    .input-group input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .result {
        font-size: 0.8rem; /* Reduced from 0.85rem */
        padding: 0.25rem; /* Reduced from 0.5rem */
        margin-top: 0.2rem; /* Further reduction */
    }
    
    .result-value {
        font-size: 0.9rem; /* Further reduction */
    }
    
    .live-answer {
        padding: 0.25rem; /* Reduced from 0.5rem */
        margin-top: 0.2rem; /* Further reduction */
    }
    
    .charts-section {
        margin: 0.25rem 0; /* Reduced from 0.5rem */
        padding: 0.25rem; /* Reduced from 0.5rem */
    }

    .chart-row {
        gap: 0.2rem; /* Further reduction */
        margin-bottom: 0.2rem; /* Further reduction */
    }

    .chart-item {
        padding: 0.4rem; /* Reduced from 0.8rem */
        border-radius: var(--radius-md); /* Slightly smaller radius */
    }

    .chart-wrapper {
        min-height: 200px; /* Reduced from 250px */
        padding: 0.1rem; /* Added small padding */
    }
    
    .site-footer {
        padding: 0.2rem; /* Further reduction */
        margin-top: 0.2rem; /* Further reduction */
    }

    .footer-content p {
        font-size: 0.75rem; /* Further reduction */
        margin: 0.05rem 0; /* Further reduction */
    }
}

/* Override for Tips Equal on tablets to ensure 3 fields in one row */
@media screen and (max-width: 768px) {
    #tips-equal .calc-inputs .input-group {
        flex: 0 1 31% !important;
        min-width: 0 !important;
    }
}

/* ============== SMALL-MEDIUM SCREENS (769px - 900px) ============== */
@media screen and (max-width: 900px) and (min-width: 769px) {
    .nav-links {
        gap: 0.6rem;
    }
    
    .nav-links a {
        padding: 0.3rem 0.6rem;
        font-size: 0.9rem;
    }
    
    .nav-container {
        padding: 0 0.8rem;
    }
    
    .site-logo {
        height: 50px;
        margin: -8px 0;
    }
}

/* ============== MEDIUM SCREENS (901px - 1023px) ============== */
@media screen and (max-width: 1023px) and (min-width: 901px) {
    .nav-links {
        gap: 0.8rem;
    }
    
    .nav-links a {
        padding: 0.35rem 0.7rem;
        font-size: 0.92rem;
    }
    
    /* Ensure nav doesn't overflow */
    .nav-container {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    /* Smaller logo on medium screens */
    .site-logo {
        height: 55px;
        margin: -9px 0;
    }
}

/* ============== DESKTOP DEVICES (1024px+) ============== */
@media screen and (min-width: 1024px) {
    /* Enhanced input field minimum widths for desktop */
    .input-group input {
        min-width: 160px; /* Desktop minimum width */
        padding: 0.8rem;
    }
    
    /* Flexbox optimization for desktop */
    .calc-inputs .input-group {
        flex: 1 1 160px;
        min-width: 160px;
    }
    
    /* Enhanced spacing for desktop */
    .calculator-container {
        padding: 2rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    /* Multi-column layout for charts on desktop */
    .chart-row {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    /* Touch targets don't need to be as large on desktop */
    .calc-tab {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Override for Tips Equal to ensure 3 fields in one row */
    #tips-equal .calc-inputs .input-group {
        flex: 0 1 31% !important;
        min-width: 0 !important;
    }
}

/* Charts Section Styles */
.charts-section {
    margin: 0.5rem 0; /* Reduced from 1rem */
    padding: 0.5rem; /* Reduced from 1rem */
}

.charts-section h2 {
    text-align: center;
    color: var(--color-text-primary);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Chart row layout - default is two columns */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem; /* Reduced from 1rem */
    margin-bottom: 0.5rem; /* Reduced from 1rem */
    align-items: start;
}

/* Single chart layout for first three tabs */
.chart-row.single-chart {
    grid-template-columns: 1fr;
    justify-items: center;
}

/* Hide second chart container when in single-chart mode */
.chart-row.single-chart .chart-item:nth-child(2) {
    display: none;
}

.chart-row.full-width {
    grid-template-columns: 1fr;
}

/* Chart item enhanced animations */
.chart-item {
    background: white;
    border-radius: var(--radius-lg);
    padding: 0.5rem; /* Reduced from 1rem */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--color-primary-10);
    transform: translateY(0) scale(1);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    contain: layout style paint;
    will-change: transform;
}

.chart-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--color-primary-10), transparent);
    transition: left 0.8s ease-out;
    z-index: 1;
}

.chart-item:hover::before {
    left: 100%;
}

.chart-item:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--color-primary-20);
}

/* Chart update animation */
.chart-item.updating {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.25), 0 2px 12px rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 152, 0, 0.4);
    animation: chartUpdateContained 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chart-item.updating::before {
    left: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 152, 0, 0.2), transparent);
}

@keyframes chartUpdateContained {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    25% {
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 8px 25px rgba(255, 152, 0, 0.3), 0 3px 15px rgba(0, 0, 0, 0.12);
    }
    50% {
        transform: translateY(-2px) scale(1.015);
        box-shadow: 0 7px 22px rgba(255, 152, 0, 0.25), 0 2.5px 13px rgba(0, 0, 0, 0.1);
    }
    75% {
        transform: translateY(-2.5px) scale(1.018);
        box-shadow: 0 6.5px 21px rgba(255, 152, 0, 0.28), 0 2.2px 12px rgba(0, 0, 0, 0.11);
    }
    100% {
        transform: translateY(-2px) scale(1.01);
        box-shadow: 0 6px 20px rgba(255, 152, 0, 0.25), 0 2px 12px rgba(0, 0, 0, 0.1);
    }
}

/* Chart title enhanced animations */
.chart-item h3 {
    color: var(--color-text-primary);
    font-size: 1rem;
    margin-bottom: 0.4rem; /* Reduced from 0.8rem */
    font-weight: 600;
    text-align: center;
    position: relative;
    z-index: 2;
    transition: var(--transition-smooth);
}

.chart-item.updating h3 {
    color: #ff6f00;
    text-shadow: 0 1px 3px rgba(255, 111, 0, 0.3);
    animation: titlePulse 0.6s ease-out;
}

@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 1px 3px rgba(255, 111, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        text-shadow: 0 2px 8px rgba(255, 111, 0, 0.6), 0 0 15px rgba(255, 152, 0, 0.4);
    }
}

/* Chart Wrappers */
.chart-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem; /* Reduced from 0.2rem */
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    min-height: 300px;
    width: 100%;
}

/* SVG Specific Styles */
.chart-wrapper svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    overflow: visible;
}

/* D3.js Chart Container Styles */
#budgetChart, #surveyChart {
    width: 100%;
    min-height: 320px; /* Updated to match new default height */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG Text Elements */
.chart-wrapper svg text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    fill: #333;
    dominant-baseline: central;
}

/* Ensure chart elements always have full opacity (fix for transparency issues) */
.chart-wrapper svg path,
.chart-wrapper svg rect {
    opacity: 1 !important;
}

/* Canvas styles */
canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(1);
    filter: brightness(1) contrast(1);
    box-sizing: border-box;
    position: relative;
}

canvas:hover {
    transform: scale(1.01);
    filter: brightness(1.03) contrast(1.05);
    box-shadow: var(--shadow-md);
}

/* Tips subtabs styles - Updated to match main tabs design */
.tips-subtabs {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.tips-subtab {
    background: var(--color-bg-white);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 200px;
    text-align: center;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tips-subtab:hover {
    background: var(--color-bg-light);
    border-color: var(--color-primary-20);
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tips-subtab:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.tips-subtab.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    transform: translateY(0);
    box-shadow: 0 4px 12px var(--color-primary-30);
}

.tips-subtab.active:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.tips-subtab-content {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* New micro-interactions */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.97);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes inputFocus {
    0% {
        box-shadow: 0 0 0 4px var(--color-primary-15);
    }
    100% {
        box-shadow: 0 0 0 4px var(--color-primary-15), 0 0 20px var(--color-primary-10);
    }
}

/* Button press effect */
.calc-tab:active,
.tips-subtab:active {
    animation: buttonPress 0.2s ease;
}

/* Input focus animation */
.input-group input:focus {
    animation: inputFocus 0.3s ease forwards;
}

/* Smooth page load */
.calculator-section {
    animation: fadeIn 0.5s ease;
}

.educational-card {
    animation: slideIn 0.6s ease;
    animation-fill-mode: both;
}

.educational-card:nth-child(1) { animation-delay: 0.1s; }
.educational-card:nth-child(2) { animation-delay: 0.2s; }
.educational-card:nth-child(3) { animation-delay: 0.3s; }
.educational-card:nth-child(4) { animation-delay: 0.4s; }
.educational-card:nth-child(5) { animation-delay: 0.5s; }
.educational-card:nth-child(6) { animation-delay: 0.6s; }

/* Tab responsive text */
.calc-tab .tab-text-full {
    display: inline;
}

.calc-tab .tab-text-short {
    display: none;
}

@media screen and (max-width: 480px) {
    .calc-tab .tab-text-full {
        display: none;
    }
    
    .calc-tab .tab-text-short {
        display: inline;
    }
    
    /* Hero section mobile adjustments */
    .hero-section {
        padding: 1.8rem 0.5rem;
        min-height: 160px; /* Reduced height for mobile */
    }
    
    .hero-section h1,
    .hero-section h2 {
        font-size: 1.6rem;
    }
    
    .hero-section .subtitle,
    .hero-section .article-meta {
        font-size: 0.95rem;
    }
    
    .tips-subtabs {
        gap: 0.3rem;
        margin-bottom: 0.8rem;
    }
    
    .tips-subtab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .charts-section {
        margin: 0.25rem 0; /* Reduced from 0.5rem */
        padding: 0.25rem; /* Reduced from 0.5rem */
    }
    
    .chart-item {
        padding: 0.4rem; /* Reduced from 0.8rem */
    }
    
    .chart-wrapper {
        min-height: 250px; /* Updated to match mobile chart height */
    }
    
    #budgetChart, #surveyChart {
        min-height: 250px; /* Updated for mobile responsiveness */
    }
}

@media screen and (max-width: 320px) {
    /* Hero section adjustments for very small screens */
    .hero-section {
        padding: 1.5rem 0.5rem;
        min-height: 140px; /* Reduced height for small screens */
    }
    
    .hero-section h1,
    .hero-section h2 {
        font-size: 1.4rem;
    }
    
    .hero-section .subtitle,
    .hero-section .article-meta {
        font-size: 0.85rem;
    }
    
    .tips-subtab {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        flex: 1;
        max-width: none;
    }
    
    .calc-tab {
        padding: 0.3rem 0.25rem; /* Reduced from 0.4rem 0.5rem */
        font-size: 0.75rem; /* Reduced from 0.8rem */
        margin: 0 0.05rem; /* Reduced from 0.1rem */
    }
    
    .chart-wrapper {
        min-height: 220px; /* Updated to match small mobile chart height */
    }
    
    #budgetChart, #surveyChart {
        min-height: 220px; /* Updated for small mobile responsiveness */
    }
}

/* Additional optimization for very small mobile screens */
@media screen and (max-width: 280px) {
    .charts-section {
        margin: 0.25rem 0;
        padding: 0.25rem;
    }
    
    .chart-item {
        padding: 0.25rem;
        margin-bottom: 0.5rem;
    }
    
    .chart-wrapper {
        min-height: 200px;
        padding: 0.1rem;
    }
    
    #budgetChart, #surveyChart {
        min-height: 200px;
    }
}

/* Collapsible charts option for mobile - reduce visual clutter */
@media screen and (max-width: 480px) {
    .charts-section {
        /* Add subtle border to make charts feel contained */
        border: 1px solid var(--color-primary-10);
        border-radius: var(--radius-lg);
        padding: 0.75rem;
        margin: 1rem 0;
        background: rgba(248, 249, 250, 0.5);
    }
    
    /* Ensure single-column layout on mobile */
    .chart-row.single-chart {
        grid-template-columns: 1fr !important;
    }
    
    .chart-row:not(.single-chart) {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
    
    /* Optimize chart text for mobile readability */
    .chart-wrapper svg text {
        font-size: 11px !important;
    }
    
    /* Force full opacity for chart elements to prevent transparency issues on mobile */
    .chart-wrapper svg path,
    .chart-wrapper svg rect {
        opacity: 1 !important;
    }
}

/* Slider Styles */
.slider-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced from 12px */
    margin: 16px 0 12px 0;
    position: relative;
    width: 100%;
    flex: 1 1 100%;
}

.slider-min,
.slider-max {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    min-width: 40px;
    text-align: center;
    user-select: none;
}

.tip-slider,
.savings-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: none;
    flex: 1;
    height: 8px;
    background: linear-gradient(to right, 
        var(--color-accent) 0%, 
        var(--color-accent) var(--slider-progress, 36%), 
        #dee2e6 var(--slider-progress, 36%), 
        #dee2e6 100%);
    border-radius: 25px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tip-slider:hover,
.savings-slider:hover {
    height: 10px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15), 
                0 2px 12px rgba(33, 150, 243, 0.2);
}

.tip-slider::-webkit-slider-thumb,
.savings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px; /* Reduced from 24px */
    height: 20px; /* Reduced from 24px */
    background: linear-gradient(135deg, var(--color-accent), #64b5f6);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 
                0 0 0 1px rgba(33, 150, 243, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.tip-slider:hover::-webkit-slider-thumb,
.savings-slider:hover::-webkit-slider-thumb {
    width: 24px; /* Reduced from 28px */
    height: 24px; /* Reduced from 28px */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 
                0 0 0 2px rgba(33, 150, 243, 0.4);
    transform: scale(1.1);
}

/* Mobile responsive improvements */
@media screen and (max-width: 768px) {
    .tip-slider,
    .savings-slider {
        height: 8px; /* Reduced from 10px */
    }
    
}


/* Educational Articles Styles */
.calculator-article {
    margin-top: 1.5rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition-normal);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    background: var(--color-bg-primary);
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.3s ease;
}

.article-header:hover {
    background: #e9ecef;
}

.article-header:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.article-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
}

.article-toggle {
    font-size: 0.8rem;
    color: #666;
    transition: transform 0.3s ease;
}

.article-header[aria-expanded="true"] .article-toggle {
    transform: rotate(180deg);
}

/* Old .article-content styles removed - using new unified styles */

/* Old responsive article styles - replaced by unified responsive styles above */
@media screen and (max-width: 768px) {
    .calculator-article {
        margin-top: 1rem;
    }
    
    .article-header {
        padding: 0.8rem;
    }
    
    .article-header h3 {
        font-size: 0.9rem;
    }
}

@media screen and (max-width: 480px) {
    .article-header h3 {
        font-size: 0.85rem;
    }
}

/* Legal Pages Styles */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    line-height: 1.7;
}

.legal-page h1 {
    color: #333;
    border-bottom: 3px solid var(--color-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.legal-page h2 {
    color: var(--color-accent);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.legal-page h3 {
    color: #333;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.legal-page section {
    margin-bottom: 2rem;
}

.legal-page ul, .legal-page ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-page li {
    margin-bottom: 0.5rem;
}

.legal-page p {
    margin-bottom: 1rem;
    color: #555;
}

.legal-page a {
    color: var(--color-accent);
    text-decoration: none;
}

.legal-page a:hover {
    text-decoration: underline;
}

.legal-page strong {
    color: #333;
}

/* Footer Navigation */
.footer-nav {
    margin-top: 1rem;
}

.footer-nav a {
    color: #ccc;
    text-decoration: none;
    margin: 0 0.5rem;
    font-size: 0.9rem;
}

.footer-nav a:hover {
    color: white;
    text-decoration: underline;
}

/* Educational Navigation Styles */
.educational-nav {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #444;
}

.educational-nav h3 {
    color: var(--color-primary);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.educational-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.educational-links a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-xs);
    background: var(--color-primary-10);
    transition: var(--transition-normal);
}

.educational-links a:hover {
    color: white;
    background: var(--color-primary-20);
    text-decoration: none;
}

/* Responsive adjustments for legal pages */
@media screen and (max-width: 768px) {
    .legal-page {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .legal-page h1 {
        font-size: 1.5rem;
    }
    
    .legal-page h2 {
        font-size: 1.2rem;
    }
    
    .footer-nav a {
        display: inline-block;
        margin: 0.2rem 0.3rem;
    }
    
    /* Educational nav responsive */
    .educational-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .educational-links a {
        text-align: center;
        padding: 0.5rem;
    }
}

@media screen and (max-width: 480px) {
    .legal-page {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .footer-nav a {
        font-size: 0.8rem;
        margin: 0.1rem 0.2rem;
    }
    
    /* Educational nav mobile styles */
    .educational-links a {
        font-size: 0.8rem;
        padding: 0.4rem;
    }
    
    /* Educational Section Mobile */
    .educational-section {
        padding: var(--space-xl) var(--space-sm);
        margin-top: var(--space-xl);
    }
    
    .educational-section h2 {
        font-size: 1.5rem;
    }
    
    .section-description {
        font-size: 1rem;
        margin-bottom: var(--space-lg);
    }
    
    .educational-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .educational-card {
        padding: var(--space-md);
    }
    
    .card-icon {
        font-size: 2rem;
    }
    
    .educational-card h3 {
        font-size: 1.1rem;
    }
    
    .educational-card p {
        font-size: 0.9rem;
    }
    
    .btn-secondary {
        padding: var(--space-sm) var(--space-lg);
        font-size: 0.9rem;
    }
}

/* ===== TIP CONTAINER STYLES ===== */

.tip-container {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    margin: 8px 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
    position: relative;
    min-height: 32px;
    -webkit-border-radius: var(--radius-sm);
    -moz-border-radius: var(--radius-sm);
}

.tip-icon {
    margin-right: 6px;
    font-size: 14px;
    flex-shrink: 0;
}

.tip-text {
    flex: 1;
    margin-right: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tip-refresh {
    background: none;
    border: none;
    font-size: 12px;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.2s ease;
    flex-shrink: 0;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-transition: opacity 0.3s ease, background-color 0.2s ease;
    -moz-transition: opacity 0.3s ease, background-color 0.2s ease;
}

.tip-container:hover .tip-refresh {
    opacity: 1;
}

.tip-refresh:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.tip-refresh:focus {
    opacity: 1;
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .tip-container {
        font-size: 12px;
        padding: 5px 10px;
        margin: 6px 0;
    }
    
    .tip-icon {
        font-size: 13px;
        margin-right: 5px;
    }
    
    .tip-refresh {
        font-size: 11px;
    }
}

/* Very small screens - hide refresh button */
@media (max-width: 480px) {
    .tip-refresh {
        display: none;
    }
    
    .tip-text {
        margin-right: 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tip-container {
        border: 2px solid #000;
        background: #fff;
        color: #000;
    }
}

/* Educational Content Styles - Unified for all educational sections */
.educational-content {
    margin-top: 2rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 1.5rem;
}

/* UNIFIED EDUCATIONAL CONTENT STYLES - Apply to all educational sections */
.content-section .content-inner,
.calculator-guide,
.educational-article {
    /* Базові стилі контейнера */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #2d3748;
    line-height: 1.7;
}

/* Уніфіковані стилі заголовків H3 */
.content-section h3,
.calculator-guide h3,
.educational-article h3 {
    color: #2d3748;
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
    line-height: 1.4;
}

/* Уніфіковані стилі заголовків H4 */
.content-section h4,
.calculator-guide h4,
.educational-article h4 {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.8rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

/* Уніфіковані стилі параграфів */
.content-section p,
.calculator-guide p,
.educational-article p {
    line-height: 1.7;
    margin-bottom: 1rem;
    color: #2d3748;
    text-align: justify;
    font-size: 1rem;
}

/* Уніфіковані стилі списків */
.content-section ul,
.content-section ol,
.calculator-guide ul,
.calculator-guide ol,
.educational-article ul,
.educational-article ol {
    margin: 1rem 0;
    padding-left: 2rem;
    line-height: 1.6;
}

.content-section li,
.calculator-guide li,
.educational-article li {
    margin-bottom: 0.6rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

/* Уніфіковані стилі для strong/bold тексту */
.content-section strong,
.calculator-guide strong,
.educational-article strong {
    color: #2d3748;
    font-weight: 600;
}

.content-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 30%, var(--color-primary) 60%, #8b7bd8 100%);
    background-size: 200% 100%;
    background-position: 0% 50%;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal), background-position 0.6s ease;
    box-shadow: var(--shadow-sm);
}

.content-toggle:hover {
    background-position: 50% 50%;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px var(--color-primary-30);
}

.content-toggle[aria-expanded="true"] {
    background-position: 100% 50%;
}

.content-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-30);
}

.toggle-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.content-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg) scale(1.1);
}

.content-section {
    margin-top: 1rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: var(--transition-bounce);
    padding: 0;
}

.content-section.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    max-height: none; /* Видаляємо обмеження висоти для повного показу контенту */
    padding: 1.5rem;
}

/* Old .calculator-guide styles replaced by unified styles above */

/* UNIFIED MOBILE RESPONSIVE STYLES FOR EDUCATIONAL CONTENT */
@media (max-width: 768px) {
    .educational-content {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
    
    .content-toggle {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .content-section.show {
        padding: 1rem;
    }
    
    /* Уніфіковані мобільні стилі заголовків H3 */
    .content-section h3,
    .calculator-guide h3,
    .educational-article h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    /* Уніфіковані мобільні стилі заголовків H4 */
    .content-section h4,
    .calculator-guide h4,
    .educational-article h4 {
        font-size: 1rem;
        margin-top: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    /* Уніфіковані мобільні стилі параграфів */
    .content-section p,
    .calculator-guide p,
    .educational-article p {
        font-size: 0.95rem;
        margin-bottom: 0.9rem;
        line-height: 1.6;
    }
    
    /* Уніфіковані мобільні стилі списків */
    .content-section ul,
    .content-section ol,
    .calculator-guide ul,
    .calculator-guide ol,
    .educational-article ul,
    .educational-article ol {
        padding-left: 1.5rem;
        margin: 0.8rem 0;
    }
    
    .content-section li,
    .calculator-guide li,
    .educational-article li {
        margin-bottom: 0.5rem;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    /* Додаткові стилі для дуже малих екранів */
    .content-section h3,
    .calculator-guide h3,
    .educational-article h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .content-section h4,
    .calculator-guide h4,
    .educational-article h4 {
        font-size: 0.95rem;
        margin-top: 1.2rem;
        margin-bottom: 0.6rem;
    }
    
    .content-section p,
    .calculator-guide p,
    .educational-article p {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
    }
    
    .content-section ul,
    .content-section ol,
    .calculator-guide ul,
    .calculator-guide ol,
    .educational-article ul,
    .educational-article ol {
        padding-left: 1.2rem;
        margin: 0.6rem 0;
    }
}

/* ==================== ARTICLE PAGE STYLES ==================== */

/* Main navigation for articles */
.main-nav {
    background: var(--color-header-bg);
    padding: 1rem 0;
    box-shadow: 0 2px 10px var(--color-header-shadow);
    border-bottom: 1px solid var(--color-header-border);
    width: 100%;
    overflow-x: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.nav-container .logo h1 {
    margin: 0;
    line-height: 1;
}

.nav-container .logo a {
    color: var(--color-header-text);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

/* Logo image styles */
.site-logo {
    height: 60px;
    width: auto;
    display: block;
    margin: -10px 0;
}

/* Logo hover effect */
.logo a:hover .site-logo {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

/* Ad banner container between nav and hero */
.ad-banner-container {
    background: #f8f9fa;
    padding: 10px 0;
    text-align: center;
    border-bottom: 1px solid var(--color-header-border);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure ad is centered and responsive */
.ad-banner-container .adsbygoogle {
    max-width: 970px;
    margin: 0 auto;
}

/* Hamburger menu button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 30px;
    position: relative;
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--color-header-text);
    border-radius: 2px;
    transition: all 0.3s ease;
    position: absolute;
    left: 0;
}

.hamburger:nth-child(1) {
    top: 0;
}

.hamburger:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger:nth-child(3) {
    bottom: 0;
}

/* Hamburger animation when active */
.menu-toggle.active .hamburger:nth-child(1) {
    transform: rotate(45deg);
    top: 50%;
    margin-top: -1.5px;
}

.menu-toggle.active .hamburger:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .hamburger:nth-child(3) {
    transform: rotate(-45deg);
    bottom: 50%;
    margin-bottom: -1.5px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.nav-links a {
    color: var(--color-header-text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-links a:hover {
    color: var(--color-primary);
    background-color: var(--color-primary-10);
}

.nav-links a.active {
    background-color: var(--color-primary);
    color: white;
}

/* Article content layout - unified with main site design */
.article-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(0.5rem, 2vw, 1rem);
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    background: transparent;
    width: 100%;
    overflow-x: hidden;
}

.article-content .container {
    background: white;
    border-radius: var(--radius-lg);
    -webkit-box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    -moz-box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-top: 1rem;
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

/* Article header - moved to hero-section */
.article-header {
    margin-bottom: 2rem;
}

.article-hero {
    text-align: center;
    color: white;
    width: 100%;
    max-width: 1200px;
}

/* Article body */
.article-body {
    line-height: 1.8;
    padding-bottom: 2rem;
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

/* Ensure all article body elements respect container width */
.article-body * {
    max-width: 100%;
}

.article-body h2 {
    color: #2d3748;
    font-size: 1.8rem;
    margin: 2rem 0 1rem 0;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 0.5rem;
}

.article-body h3 {
    color: var(--color-text-secondary);
    font-size: 1.4rem;
    margin: 1.5rem 0 1rem 0;
}

.article-body h4 {
    color: var(--color-text-secondary);
    font-size: 1.2rem;
    margin: 1.2rem 0 0.8rem 0;
}

.article-body p {
    color: var(--color-text-secondary);
    margin-bottom: 1.2rem;
    font-size: 1rem;
    text-align: justify;
    text-justify: inter-word;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

.article-body ul,
.article-body ol {
    color: var(--color-text-secondary);
    margin: 1rem 0 1.5rem 0;
    padding-left: 2rem;
    max-width: 100%;
}

.article-body li {
    margin-bottom: 0.5rem;
    text-align: justify;
    text-justify: inter-word;
}

.article-body strong {
    color: #2d3748;
    font-weight: 600;
}

.article-body a {
    color: var(--color-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.article-body a:hover {
    border-bottom-color: var(--color-primary);
}

/* Ensure all article content text is justified */
.article-body section p,
.article-body div p,
.faq-item p,
.example-box p,
.tip-guide-box p,
.budget-breakdown-box p {
    text-align: justify;
    text-justify: inter-word;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Special content boxes */
.formula-box,
.mistake-box,
.example-box,
.practice-box,
.checklist-box,
.tip-guide-box,
.budget-breakdown-box {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 1.5rem 0;
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
}

.formula-box {
    border-left: 4px solid var(--color-primary);
}

.mistake-box {
    border-left: 4px solid #e53e3e;
}

.example-box {
    border-left: 4px solid #38a169;
}

.practice-box {
    border-left: 4px solid #d69e2e;
}

.checklist-box {
    border-left: 4px solid #805ad5;
}

.formula-box h3,
.mistake-box h3,
.example-box h3,
.practice-box h4,
.checklist-box h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Practice problems details */
details {
    margin: 1rem 0;
}

summary {
    cursor: pointer;
    padding: 0.5rem;
    background: #edf2f7;
    border-radius: var(--radius-xs);
    font-weight: 500;
}

summary:hover {
    background: #e2e8f0;
}

/* Article footer */
.article-footer {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-top: 2rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.article-footer p {
    margin: 0;
    color: var(--color-text-secondary);
}

/* Related content sidebar */
/* Content grid layout for articles */
.article-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

.related-content {
    background: var(--color-gray-50);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-gray-200);
    height: fit-content;
}

.related-content h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.related-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-content li {
    margin-bottom: 0.8rem;
}

.related-content a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    display: block;
    border-bottom: 1px solid transparent;
    transition: var(--transition-normal);
}

.related-content a:hover {
    color: #4c51bf;
    border-bottom-color: var(--color-primary);
    padding-left: 0.5rem;
}

/* Ad container */
.ad-container {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin: 2rem auto;
    max-width: 1000px;
    text-align: center;
}

/* Responsive design for articles */
@media screen and (max-width: 1024px) {
    .article-content .container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .article-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .related-content {
        order: 2;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-links {
        gap: 0.8rem;
    }
    
    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.95rem;
    }
    
    /* Ensure main content doesn't overflow */
    body {
        overflow-x: hidden;
        position: relative;
        width: 100%;
    }
    
    .main-nav {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Ensure all content respects viewport width */
    .article-content,
    .container,
    .article-grid,
    .article-body {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Show hamburger menu on mobile */
    .menu-toggle {
        display: flex;
    }
    
    /* Mobile navigation styles */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background-color: var(--color-header-bg);
        flex-direction: column;
        padding: 80px 20px 20px;
        gap: 0;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    /* When menu is active */
    .nav-links.active {
        right: 0;
    }
    
    /* Style navigation links for mobile */
    .nav-links a {
        padding: 15px 20px;
        margin: 0;
        width: 100%;
        text-align: left;
        border-radius: 0;
        border-bottom: 1px solid var(--color-header-border);
    }
    
    .nav-links a:first-child {
        border-top: 1px solid var(--color-header-border);
    }
    
    /* Overlay for mobile menu */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .nav-overlay.active {
        display: block;
    }
}

@media screen and (max-width: 768px) {
    body {
        padding-top: 70px; /* Reduced for smaller header on tablets */
    }
    
    .article-content .container {
        padding: 0 1rem;
    }
    
    /* Logo responsiveness */
    .site-logo {
        height: 50px;
        margin: -8px 0;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    /* Ad banner responsive */
    .ad-banner-container {
        padding: 8px 10px;
        min-height: 70px;
    }
    
    .article-header,
    .article-body,
    .related-content {
        padding: 1.5rem;
    }
    
    .article-header h1 {
        font-size: 2rem;
    }
    
    .article-body h2 {
        font-size: 1.5rem;
    }
    
    /* Remove conflicting styles - handled by burger menu now */
}

@media screen and (max-width: 480px) {
    body {
        padding-top: 65px; /* Reduced for smaller header on mobile */
    }
    
    .article-header h1 {
        font-size: 1.8rem;
    }
    
    .article-body {
        padding: 1rem;
    }
    
    .article-body p,
    .article-body li {
        text-align: left; /* On very small screens, left align for better readability */
    }
    
    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Ad banner mobile */
    .ad-banner-container {
        padding: 6px 8px;
        min-height: 60px;
    }
    
    /* Content boxes mobile adjustments */
    .formula-box,
    .mistake-box,
    .example-box,
    .practice-box,
    .checklist-box,
    .tip-guide-box,
    .budget-breakdown-box {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    /* Logo mobile */
    .site-logo {
        height: 45px;
        margin: -7px 0;
    }
}

/* Old responsive calculator styles removed - replaced with new section below */

/* ==================== COMPLETELY REDESIGNED RESPONSIVE LAYOUT ==================== */

/* RESET AND BASE CALCULATOR LAYOUT */
.calc-inputs {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    align-items: flex-end;
}

/* Force slider to be on separate row for all screen sizes */
#tips-equal .calc-inputs .slider-container,
#savings .calc-inputs .slider-container {
    flex: 1 1 100%;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.calc-inputs .input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
}

.calc-inputs .input-group label {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.2;
    overflow-wrap: break-word;
    word-break: break-word;
}

.calc-inputs .input-group input {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    min-height: 42px;
    box-sizing: border-box;
}

/* RESULT BLOCK STYLING */
.calc-inputs .live-answer {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8efff 100%);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: 0 4px 16px rgba(91, 127, 255, 0.12);
    text-align: center;
    width: 100%;
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.live-answer .main-answer {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.3rem;
    word-break: break-word;
    line-height: 1.2;
}

.live-answer .formula {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    opacity: 0.8;
    line-height: 1.3;
}

/* ==================== MOBILE LAYOUT (max-width: 768px) ==================== */
@media (max-width: 768px) {
    .calculator {
        padding: 1rem;
    }
    
    .calculator h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    /* Базова структура для мобільних */
    .calc-inputs {
        gap: 0.75rem;
    }
    
    .calc-inputs .input-group {
        gap: 0.3rem;
    }
    
    .calc-inputs .input-group input {
        font-size: 16px;
        padding: 12px 14px;
        min-height: 44px;
    }
    
    .calc-inputs .live-answer {
        padding: 0.75rem;
        text-align: center;
    }
    
    .live-answer .main-answer {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
        text-align: center;
        display: block;
    }
    
    .live-answer .formula {
        font-size: 0.7rem;
        text-align: center;
        display: block;
    }
    
    /* Калькулятори 1-3 (% of, What %, Change) - 2 поля в ряд */
    #what-percent-of .calc-inputs,
    #what-percent-is .calc-inputs,
    #percent-change .calc-inputs {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    #what-percent-of .calc-inputs .input-group,
    #what-percent-is .calc-inputs .input-group,
    #percent-change .calc-inputs .input-group {
        flex: 0 1 calc(50% - 0.375rem);
        min-width: 0;
    }
    
    #what-percent-of .calc-inputs .live-answer,
    #what-percent-is .calc-inputs .live-answer,
    #percent-change .calc-inputs .live-answer {
        flex: 1 1 100%;
        margin-top: 0.75rem;
    }
    
    /* Калькулятор 4 - Tip Split Equal - 3 поля в ряд */
    #tips-equal .calc-inputs {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2%;
        justify-content: space-between;
    }
    
    #tips-equal .calc-inputs .input-group {
        flex: 0 1 31% !important;
        min-width: 0 !important;
    }
    
    #tips-equal .calc-inputs .input-group input {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    #tips-equal .calc-inputs .slider-container {
        flex: 1 1 100%;
        margin: 1rem 0;
    }
    
    #tips-equal .calc-inputs .live-answer {
        flex: 1 1 100%;
        margin-top: 0.75rem;
    }
    
    /* Калькулятор 4 - Tip Split Custom */
    #tips-specific .calc-inputs {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    /* Bill total, Person 1, Person 2 - перший ряд */
    #tips-specific .calc-inputs .input-group:nth-child(1),
    #tips-specific .calc-inputs .input-group:nth-child(2),
    #tips-specific .calc-inputs .input-group:nth-child(3) {
        grid-column: span 1;
    }
    
    /* Person 3, 4, 5 - другий ряд */
    #tips-specific .calc-inputs .input-group:nth-child(4),
    #tips-specific .calc-inputs .input-group:nth-child(5),
    #tips-specific .calc-inputs .input-group:nth-child(6) {
        grid-column: span 1;
    }
    
    /* Average tip - третій ряд */
    #tips-specific .calc-inputs .result {
        grid-column: 1 / -1;
        margin-top: 1.5rem;
        padding: 0.75rem;
        background: linear-gradient(135deg, #f8f9ff 0%, #e8efff 100%);
        border: 2px solid var(--color-primary);
        border-radius: var(--radius-lg);
        text-align: center;
    }
    
    /* Відступ для слайдера в Custom режимі */
    #tips-specific .slider-container {
        margin-top: 1.5rem;
    }
    
    /* Відступ між слайдером і результатом в Custom режимі */
    #tips-specific .live-answer {
        margin-top: 1.5rem;
    }
    
    /* Калькулятор 5 - Savings */
    #savings .calc-inputs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    /* Monthly income, Save % - перший ряд */
    #savings .calc-inputs .input-group:nth-child(1),
    #savings .calc-inputs .input-group:nth-child(2) {
        grid-column: span 1;
    }
    
    /* Monthly savings, Years - другий ряд */
    #savings .calc-inputs .input-group:nth-child(3),
    #savings .calc-inputs .input-group:nth-child(4) {
        grid-column: span 1;
    }
    
    /* Слайдер - третій ряд */
    #savings .calc-inputs .slider-container {
        grid-column: 1 / -1;
        margin: 1rem 0;
    }
    
    /* Результат - четвертий ряд */
    #savings .calc-inputs .live-answer {
        grid-column: 1 / -1;
        margin-top: 0.75rem;
    }
    
    /* Слайдери */
    .slider-container {
        margin-top: 1rem;
    }
    
    /* Навігація по вкладках */
    .calculator-nav {
        flex-wrap: wrap;
        gap: 0.25rem;
        margin-bottom: 1rem;
    }
    
    .calc-tab {
        flex: 1 1 auto;
        min-width: 60px;
        font-size: 0.85rem;
        padding: 0.6rem 0.5rem;
    }
    
    /* Приховування довгих текстів на малих екранах */
    @media (max-width: 480px) {
        .calc-tab .tab-text-full {
            display: none;
        }
        
        .calc-tab .tab-text-short {
            display: inline;
        }
    }
    
    
    /* Charts на мобільних */
    .chart-row {
        grid-template-columns: 1fr !important;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .charts-section {
        margin: 0.5rem 0;
        padding: 0.5rem;
    }
    
    .chart-item {
        padding: 0.75rem;
    }
}

/* Override for Tips Equal to ensure proper layout */
#tips-equal .calc-inputs .input-group {
    flex: 1 1 30% !important;
    min-width: 60px !important;
    max-width: calc(33.333% - 0.334rem) !important;
}

/* ==================== DESKTOP LAYOUT (min-width: 769px) ==================== */
@media (min-width: 769px) {
    /* Desktop styles for tip and savings calculators */
    
    
    #tips-equal .calc-inputs .slider-container {
        flex: 1 1 100%;
        width: 100%;
        margin: 1.5rem 0 1rem 0;
    }
    
    #tips-equal .calc-inputs .live-answer {
        flex: 1 1 100%;
        margin-top: 1rem;
    }
    
    /* Savings Calculator layout */
    #savings .calc-inputs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    #savings .calc-inputs .input-group:nth-child(1),
    #savings .calc-inputs .input-group:nth-child(2) {
        grid-column: span 1;
    }
    
    #savings .calc-inputs .input-group:nth-child(3),
    #savings .calc-inputs .input-group:nth-child(4) {
        grid-column: span 1;
    }
    
    #savings .calc-inputs .slider-container {
        grid-column: 1 / -1;
        margin: 1.5rem 0 1rem 0;
    }
    
    #savings .calc-inputs .live-answer {
        grid-column: 1 / -1;
        margin-top: 1rem;
    }
    
    /* Enhanced slider styles for desktop */
    .slider-container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .tip-slider,
    .savings-slider {
        height: 10px;
    }
    
    .tip-slider::-webkit-slider-thumb,
    .savings-slider::-webkit-slider-thumb {
        width: 26px;
        height: 26px;
    }
}




/* ==================== VISUAL ENHANCEMENTS ==================== */

/* Input focus states */
.calc-inputs input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-20);
}

/* Animated result updates */
.live-answer.updated {
    animation: resultPulse 0.3s ease-out;
}

@keyframes resultPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    .calc-inputs input {
        min-height: 48px;
        font-size: 16px;
    }
    
    .calc-tab {
        min-height: 44px;
        padding: 12px 20px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .calc-inputs input {
        border-width: 2px;
    }
    
    .live-answer {
        border-width: 3px;
        background: white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ==================== ADDITIONAL SAFEGUARDS ==================== */

/* Малі екрани */
@media (max-width: 480px) {
    /* Ensure text centering on small mobile devices */
    .calc-inputs .live-answer {
        text-align: center !important;
    }
    
    .live-answer .main-answer,
    .live-answer .formula {
        text-align: center !important;
        display: block;
    }
    
}

@media (max-width: 414px) {
    /* iPhone Plus and smaller */
    
    /* Special handling for Tips Equal on iPhone Plus */
    #tips-equal .calc-inputs {
        gap: 1.8% !important;
    }
    
    #tips-equal .calc-inputs .input-group {
        flex: 0 1 30.8% !important;
    }
    
    #tips-equal .calc-inputs .input-group input {
        padding: 10px 10px !important;
    }
    
    /* Custom tips layout */
    #tips-specific .calc-inputs {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
    }
    
    #tips-specific .calc-inputs .input-group input {
        padding: 8px 6px;
        font-size: 14px;
        min-height: 38px;
    }
    
    #tips-specific .calc-inputs .input-group {
        grid-column: span 1 !important;
    }
    
    #tips-specific .calc-inputs .result {
        grid-column: 1 / -1 !important;
    }
    
}

@media (max-width: 375px) {
    /* iPhone standard - very compact */
    .calculator {
        padding: 0.5rem;
    }
    
    /* Special handling for Tips Equal on iPhone */
    #tips-equal .calc-inputs {
        gap: 1.5% !important;
    }
    
    #tips-equal .calc-inputs .input-group {
        flex: 0 1 30.5% !important;
    }
    
    #tips-equal .calc-inputs .input-group input {
        padding: 10px 8px !important;
    }
    
    
    /* Custom tips - reduce grid columns */
    #tips-specific .calc-inputs {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.25rem;
    }
    
    #tips-specific .calc-inputs .input-group input {
        padding: 8px 4px;
        font-size: 14px;
        min-height: 36px;
    }
    
    #tips-specific .calc-inputs .input-group label {
        font-size: 0.8rem;
        margin-bottom: 0.2rem;
    }
    
    #tips-specific .calc-inputs .input-group {
        grid-column: span 1 !important;
    }
    
    #tips-specific .calc-inputs .result {
        grid-column: 1 / -1 !important;
    }
    
}

/* Landscape orientation styles for mobile devices */
@media (max-width: 812px) and (orientation: landscape) {
    /* Adjust body padding for landscape */
    body {
        padding-top: 60px;
    }
    
    
    /* Custom tips landscape */
    #tips-specific .calc-inputs {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem;
    }
    
    /* Result blocks in landscape */
    .calc-inputs .live-answer {
        min-height: 80px;
        padding: 0.75rem;
    }
    
    /* Reduce header height in landscape */
    .main-nav {
        padding: 0.5rem 0;
    }
    
    .site-logo {
        height: 40px;
        margin: -5px 0;
    }
}

/* Smaller landscape screens */
@media (max-width: 667px) and (orientation: landscape) {
    
    #tips-specific .calc-inputs {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}


@media (max-width: 320px) {
    .calculator {
        padding: 0.5rem;
    }
    
    .calc-inputs {
        gap: 0.5rem;
    }
    
    /* Special handling for Tips Equal on very small screens */
    #tips-equal .calc-inputs {
        gap: 1% !important;
    }
    
    #tips-equal .calc-inputs .input-group {
        flex: 0 1 30% !important;
    }
    
    #tips-equal .calc-inputs .input-group input {
        padding: 8px 6px !important;
    }
    
    .calc-inputs input {
        font-size: 14px;
        min-height: 40px;
        padding: 10px 12px;
    }
    
    
    /* Extra small screen text centering */
    .calc-inputs .live-answer {
        padding: 0.5rem;
        text-align: center !important;
    }
    
    .live-answer .main-answer {
        font-size: 1.1rem;
    }
    
    .live-answer .formula {
        font-size: 0.65rem;
    }
}