/* Productivity Calculator Site - Main CSS File */
/* Modern, Responsive Design with Dark/Light Mode - PERFECT HORIZONTAL HEADER */

/* ========================================
   CSS Variables for Theme Management (REFINED)
   ======================================== */
:root {
    /* 1. Core Color Palette (Brand & Neutrals) */
    /* Brand Colors */
    --brand-primary: #24a8f0;
    --brand-primary-hover: #2563eb;
    --brand-accent: #f59e0b;
    --brand-gradient-start: #667eea;
    --brand-gradient-end: #764ba2;

    /* Neutral Colors (Grayscale) */
    --neutral-0: #ffffff;
    --neutral-100: #e5e7eb; /* Light Gray for borders */
    --neutral-200: #d1d5db;
    --neutral-500: #6b7280; /* Secondary Text */
    --neutral-700: #374151;
    --neutral-800: #1f2937;
    --neutral-900: #030526; /* Footer Background */
    --neutral-1000: #000000;

    /* Semantic Colors */
    --semantic-success: #10b981;
    --semantic-warning: #f59e0b;
    --semantic-danger: #ef4444;
    
    /* 2. Theme-Specific Semantic Variables (Light Theme - Default) */
    --bg-primary: var(--neutral-0);
    --bg-header: var(--neutral-0);
    --bg-card: var(--neutral-0);
    --bg-input: var(--neutral-0);
    --bg-footer: var(--neutral-900);

    --text-primary: var(--neutral-1000);
    --text-secondary: var(--neutral-500);
    --text-on-brand: var(--neutral-0);
    --text-footer-primary: var(--neutral-0);
    --text-footer-secondary: var(--neutral-200);

    --border-primary: var(--neutral-100);

    --button-bg-primary: var(--brand-primary);
    --button-bg-primary-hover: var(--brand-primary-hover);
    --button-bg-cta: var(--brand-accent);

    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-lg: rgba(0, 0, 0, 0.07);
    --shadow: 0 1px 3px var(--shadow-color);
    --shadow-lg: 0 4px 6px var(--shadow-color-lg);
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   PERFECT HORIZONTAL HEADER - ALL SCREEN SIZES
   ======================================== */

.header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

/* ALWAYS HORIZONTAL NAVIGATION */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    min-height: 60px;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: all 0.3s ease;
    
    /* REFINEMENT START: Prevents the logo text from breaking the layout if it's too long */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* REFINEMENT END */
}

.logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* Desktop Navigation Menu */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: var(--button-bg-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--button-bg-primary);
    border-radius: 1px;
}

/* HORIZONTAL HEADER CONTROLS */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/*
========================================
Header Search Form Styles
========================================
*/

/* --- 1. Search Form Container --- */
.header-search-form {
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden; /* Ensures the button fits nicely inside the rounded corners */
    transition: all 0.3s ease;
}

/* Add a focus state to the container for better visibility */
.header-search-form:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(36, 168, 240, 0.2); /* Use a transparent version of your primary color */
}

/* --- 2. Search Input Field --- */
.header-search-input {
    border: none;
    background: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    outline: none;
    color: var(--text-primary);
    width: 180px; /* Default width, can be adjusted */
    transition: width 0.3s ease;
}

/* Remove the default clear button ('x') on some browsers */
.header-search-input::-webkit-search-cancel-button {
    display: none;
}

/* Placeholder text styling */
.header-search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

/* --- 3. Search Submit Button --- */
.header-search-button {
    background-color: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.3s ease, background-color 0.3s ease;
}

.header-search-button:hover {
    color: var(--text-on-brand);
    background-color: var(--brand-primary);
}

.header-search-button svg {
    width: 16px;
    height: 16px;
}

/* FIXED MOBILE MENU TOGGLE - PROPER HAMBURGER TO X ANIMATION */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    position: relative;
    transition: all 0.3s ease;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px;
    flex-shrink: 0;
}

.mobile-menu-toggle:hover {
    background-color: var(--bg-card);
    border-color: var(--button-bg-primary);
}

.mobile-menu-toggle span {
    width: 16px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    transform-origin: center;
}

/* FIXED ANIMATION STATES - PROPER HAMBURGER TO X */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

/* Mobile Navigation - FIXED ISSUE #2: Added proper show/hide transitions */
.mobile-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-primary);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.mobile-nav.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.mobile-nav-menu li {
    border-bottom: 1px solid var(--border-primary);
}

.mobile-nav-menu li:last-child {
    border-bottom: none;
}

.mobile-nav-link {
    display: block;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--button-bg-primary);
    background-color: var(--border-primary);
}

/* ========================================
   REST OF THE STYLES (UNCHANGED)
   ======================================== */

/* Hero Section */
.hero {
    background-color: #24a8f0; /* Changed from gradient to solid green */
    color: white;
    text-align: center;
    padding: 1rem 0 !important; /* Reduced padding AND added !important */
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Calculator Sections */
.default-calculator {
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
}

.default-calculator h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.calc-form {
    max-width: 600px;
    margin: 0 auto;
}

.input-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--button-bg-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

button {
    background-color: var(--button-bg-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

button:hover {
    background-color: var(--button-bg-primary-hover);
    transform: translateY(-1px);
}

.quick-result {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--semantic-success);
    color: white;
    border-radius: 8px;
    font-size: 1.2rem;
}

/* CTA Section */
.all-calc-cta {
    text-align: center;
    margin-bottom: 3rem;
}

.cta-button {
    display: inline-block;
    background-color: var(--button-bg-cta);
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

/* Categories Grid */
.popular-categories {
    margin-bottom: 4rem;
}

.popular-categories h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--text-primary);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.category-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--button-bg-primary);
}

.category-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.category-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.category-card a {
    color: var(--button-bg-primary);
    text-decoration: none;
    font-weight: 500;
}

.category-card a:hover {
    text-decoration: underline;
}

/* Simple fallback list styling */
.simple-list-fallback { margin: 2rem 0; }
.simple-list-fallback ul { padding-left: 1.25rem; }
.simple-list-fallback li { margin-bottom: 0.5rem; }

/* Calculator List */
.all-calculators-list {
    margin-bottom: 4rem;
}

.all-calculators-list h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
    color: var(--text-primary);
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.calculator-category {
    margin-bottom: 3rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.calculator-category h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.calculator-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1rem;
}

.calculator-list li {
    padding: 0.75rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.calculator-list li:hover {
    background-color: var(--border-primary);
}

.calc-link {
    color: var(--button-bg-primary);
    text-decoration: none;
    font-weight: 500;
}

.calc-link:hover {
    text-decoration: underline;
}

.calc-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Star Rating */
.star-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.star {
    color: #fbbf24;
    font-size: 1.2rem;
}

.star.empty {
    color: var(--border-primary);
}

.rating-text {
    margin-left: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Social Share */
.social-share {
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
}

.social-share-title {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.social-share-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.social-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.social-share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid var(--border-primary);
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.social-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.social-share-btn.facebook:hover {
    background-color: #1877f2;
    color: white;
    border-color: #1877f2;
}

.social-share-btn.twitter:hover {
    background-color: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.social-share-btn.linkedin:hover {
    background-color: #0a66c2;
    color: white;
    border-color: #0a66c2;
}

.social-share-btn.pinterest:hover {
    background-color: #bd081c;
    color: white;
    border-color: #bd081c;
}

.social-share-btn.whatsapp:hover {
    background-color: #25d366;
    color: white;
    border-color: #25d366;
}

.social-share-btn.email:hover {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

/* Breadcrumbs */
.breadcrumbs-container {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-primary);
    padding: 1rem 0;
}

.breadcrumbs ol {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--button-bg-primary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.separator {
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background-color: var(--bg-footer);
    border-top: 1px solid var(--border-primary);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-title,
.footer-social h3,
.footer-social h4,
.footer-social p {
    margin-bottom: 1rem;
    color: var(--text-footer-primary);
}

.footer-description {
    color: var(--text-footer-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.footer-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.stat {
    background-color: var(--text-footer-primary);
    color: var(--bg-footer);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-footer-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--text-footer-primary);
}

.footer-social {
    text-align: center;
    margin-bottom: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-primary);
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.social-link {
    color: var(--text-footer-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.social-link:hover {
    color: var(--text-footer-primary);
}

.footer-bottom {
    border-top: 1px solid var(--border-primary);
    padding-top: 1rem;
    text-align: center;
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.copyright {
    color: var(--text-footer-secondary);
    text-align: center;
    width: 100%;
}

.footer-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-footer-secondary);
    font-size: 0.9rem;
}

/* FIXED ISSUE #3: Back to Top - Proper visibility handling */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--button-bg-primary);
    color: white;
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    
    /* Ensure perfect circle regardless of global button styles */
    padding: 0;
    box-sizing: content-box;
    -webkit-appearance: none;
    appearance: none;
    min-width: 56px !important;
    max-width: 56px;
    min-height: 56px;
    max-height: 56px;
    aspect-ratio: 1 / 1;
    
    /* Perfect centering */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Smooth transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(100px);
    opacity: 0;
    visibility: hidden; /* FIXED: Added visibility hidden by default */
    
    /* Better typography */
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

/* Show state - ADD THIS CLASS WITH JS */
#back-to-top.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible; /* FIXED: Added visibility visible when shown */
}

/* Hover effects */
#back-to-top:hover {
    background-color: var(--button-bg-primary-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Explicitly neutralize any generic button rules for this button */
#back-to-top,
#back-to-top:focus,
#back-to-top:active {
    padding: 0 !important;
}

#back-to-top:active {
    transform: translateY(0) scale(0.98);
}

/* ========================================
   PERFECT HORIZONTAL RESPONSIVE DESIGN
   ======================================== */

/* LARGE TABLET (1024px and below) */
@media (max-width: 1024px) {
    .container {
        padding: 0 18px;
    }
    
    /* Hide desktop nav, show mobile toggle */
    .nav-menu {
        display: none;
    }
    
    /* --- Responsive Search Form --- */
    .header-search-form {
        max-width: 150px;
    }
    
    .mobile-menu-toggle {
        display: flex;
        width: 34px;
        height: 34px;
        gap: 3.5px;
        padding: 7px;
    }
    
    .mobile-menu-toggle span {
        /* Fit inside the narrower width */
        width: 12px;
        height: 2px;
    }
    
    /* FIXED: Responsive animation values */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(4.5px) rotate(45deg);
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-4.5px) rotate(-45deg);
    }
    
    /* Scale header slightly */
    .nav {
        padding: 0.7rem 0;
        min-height: 58px;
    }
    
    .logo {
        font-size: 1.4rem;
        gap: 0.45rem;
    }
    
    .logo img {
        width: 38px;
        height: 38px;
    }
    
    .header-controls {
        gap: 0.6rem;
    }
}

/* TABLET (768px and below) */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    /* --- Mobile Search Form --- */
    .header-search-form {
        border: none;
        background-color: transparent;
    }
    
    .header-search-input {
        width: 0;
        padding: 0;
        opacity: 0;
        pointer-events: none;
    }
    
    .header-search-form:focus-within {
        background-color: var(--bg-input);
        border: 1px solid var(--brand-primary);
    }

    .header-search-form:focus-within .header-search-input {
        width: 120px;
        padding: 0.5rem 0.75rem;
        opacity: 1;
        pointer-events: auto;
    }

    .header-search-button {
        padding: 6px;
        border: 1px solid var(--border-primary);
        border-radius: 6px;
        height: 32px;
        /* Reduce width only, keep height */
        width: 30px;
        min-width: 0 !important; /* override global button min-width */
        box-sizing: border-box;  /* keeps total width at 30px including padding/border */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-search-form:focus-within .header-search-button {
        border: none;
        border-radius: 0;
        background-color: var(--brand-primary);
        color: var(--text-on-brand);
        width: 120px; /* expands only while focused for typing */
    }
    
    .nav {
        padding: 0.6rem 0;
        min-height: 56px;
    }
    
    .logo {
        font-size: 1.3rem;
        gap: 0.4rem;
    }
    
    .logo img {
        width: 34px;
        height: 34px;
    }
    
    .header-controls {
        gap: 0.5rem;
    }
    
    .mobile-menu-toggle {
        /* Reduce width only, keep height */
        width: 26px;
        min-width: 0 !important; /* override global button min-width */
        height: 32px;
        gap: 3px;
        padding: 4px;
        box-sizing: border-box;
    }
mportant; /* override global button min-width */
        height: 32px;
        gap: 3px;
        padding: 4px;
        box-sizing: border-box;
    }
    
    .mobile-menu-toggle span {
        width: 10px;
        height: 2px;
    }
    
    /* FIXED: Responsive animation values */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(4px) rotate(45deg);
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-4px) rotate(-45deg);
    }
    
    /* Content responsive adjustments */
    .hero {
        padding: 2.5rem 0;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .input-row {
        flex-direction: column;
        align-items: stretch; /* REFINEMENT: Ensures items are full-width */
    }

    /* REFINEMENT START: Make button full-width on mobile for better UX */
    .input-row button {
        width: 100%;
        padding: 0.85rem 1.5rem; /* Slightly taller for easier tapping */
    }
    /* REFINEMENT END */
    
    .input-group {
        min-width: 100%;
    }
    
    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .calculator-list {
        grid-template-columns: 1fr;
    }
    
    /* Back to top responsive */
    #back-to-top {
        width: 50px;
        height: 50px;
        min-width: 50px !important;
        max-width: 50px;
        min-height: 50px;
        max-height: 50px;
        bottom: 1.5rem;
        right: 1.5rem;
        font-size: 16px;
    }
}

/* MOBILE (480px and below) */
@media (max-width: 480px) {
    .container {
        padding: 0 14px;
    }
    
    /* PERFECTLY HORIZONTAL MOBILE HEADER */
    .nav {
        padding: 0.5rem 0;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .logo {
        font-size: 1.2rem;
        gap: 0.35rem;
        flex: 1;
        min-width: 0;
    }
    
    .logo img {
        width: 30px;
        height: 30px;
    }
    
    .header-controls {
        gap: 0.4rem;
        flex-shrink: 0;
    }
    
    .mobile-menu-toggle {
        /* Reduce width only, keep height */
        width: 24px;
        min-width: 0 !important;
        height: 30px;
        gap: 2.5px;
        padding: 4px;
        box-sizing: border-box;
    }
    
    .mobile-menu-toggle span {
        width: 10px;
        height: 2px;
    }
    
    /* FIXED: Responsive animation values */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(4px) rotate(45deg);
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-4px) rotate(-45deg);
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 1.9rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .default-calculator,
    .calculator-category,
    .social-share {
        padding: 1.25rem;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .social-share-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }
    
    /* Back to top responsive */
    #back-to-top {
        width: 44px;
        height: 44px;
        min-width: 44px !important;
        max-width: 44px;
        min-height: 44px;
        max-height: 44px;
        bottom: 1rem;
        right: 1rem;
        font-size: 14px;
    }
}

/* SMALL MOBILE (360px and below) */
@media (max-width: 360px) {
    .container {
        padding: 0 12px;
    }
    
    .nav {
        padding: 0.4rem 0;
        min-height: 48px;
    }
    
    .logo {
        font-size: 1.1rem;
        gap: 0.3rem;
    }
    
    .logo img {
        width: 28px;
        height: 28px;
    }
    
    .header-controls {
        gap: 0.3rem;
    }
    
    .mobile-menu-toggle {
        /* Reduce width only, keep height */
        width: 22px;
        min-width: 0 !important;
        height: 28px;
        gap: 2px;
        padding: 3px;
        box-sizing: border-box;
    }
    
    .mobile-menu-toggle span {
        width: 9px;
        height: 2px;
    }
    
    /* FIXED: Responsive animation values */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(3.5px) rotate(45deg);
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-3.5px) rotate(-45deg);
    }
    
    .hero h1 {
        font-size: 1.7rem;
    }
    
    .default-calculator,
    .calculator-category,
    .social-share {
        padding: 1rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid var(--border-primary);
    border-top: 2px solid var(--button-bg-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

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

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.hidden { display: none; }
.visible { display: block; }

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}