/* ============================================
   CalcTools Pro - Global Stylesheet
   Single CSS file for entire website
   Optimized for Performance & SEO
   Version: 1.0
   ============================================ */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #f8f9fa;
    font-size: 16px;
    overflow-x: hidden;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    transition: all 0.3s ease;
}

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

/* ============================================
   Header
   ============================================ */
header {
    background: #0066ff;
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-image {
    width: 40px;
    height: 40px;
    transition: transform 0.3s ease;
}

.logo a:hover .logo-image {
    transform: scale(1.1) rotate(5deg);
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ============================================
   Hero Section (Homepage)
   ============================================ */
.hero {
    background: linear-gradient(135deg, #0066ff 0%, #00c896 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
}

.hero p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 1rem auto 0;
}


/* ============================================
   Calculators Grid (Homepage)
   ============================================ */
.calculators-grid {
    padding: 4rem 0;
    background: white;
}

.calculators-grid h2 {
    margin: 3rem 0 1.5rem 0;
    color: #0066ff;
    font-size: 2rem;
    border-bottom: 3px solid #0066ff;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.calc-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: #1a1a1a;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.calc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,102,255,0.15);
    border-color: #0066ff;
}

.calc-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #0066ff;
}

.calc-card p {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

/* ============================================
   Calculator Page Layout
   ============================================ */
.calculator-page {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 20px;
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-top: -1rem;
    margin-bottom: 2rem;
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.9rem;
    color: #666;
}

.breadcrumb a {
    color: #0066ff;
    text-decoration: none;
}

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

.breadcrumb span {
    margin: 0 0.5rem;
}


/* ============================================
   Calculator Card (for individual pages)
   ============================================ */
.calculator-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 2rem 0;
    border: 1px solid #e9ecef;
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

input[type="number"],
input[type="text"],
input[type="month"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

input:focus,
select:focus {
    outline: none;
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0,102,255,0.1);
}

/* ============================================
   Buttons
   ============================================ */
.calculate-btn {
    width: 100%;
    padding: 16px;
    background: #0066ff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
}

.calculate-btn:hover {
    background: #0052cc;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,102,255,0.3);
}

/* Unit Toggle Buttons (for BMI/Calorie) */
.unit-toggle {
    display: flex;
    margin-bottom: 1.5rem;
    border: 1px solid #0066ff;
    border-radius: 8px;
    overflow: hidden;
}

.unit-btn {
    flex: 1;
    padding: 10px;
    background: #fff;
    color: #0066ff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s, color 0.3s;
}

.unit-btn.active {
    background: #0066ff;
    color: #fff;
}

.unit-btn:not(:last-child) {
    border-right: 1px solid #0066ff;
}

/* ============================================
   Results Display
   ============================================ */
.result-section {
    margin-top: 2rem;
    padding: 2rem;
    background: #f0f8ff;
    border-radius: 12px;
    border: 1px solid #0066ff;
    text-align: center;
    display: none; /* Initially hidden */
}

.result-section.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.result-main h2 {
    font-size: 2.2rem;
    color: #0066ff;
    margin-bottom: 0.5rem;
}

.result-main p {
    font-size: 1.1rem;
    color: #333;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #b3d9ff;
    text-align: left;
}

.result-item {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.result-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
}

.result-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #0066ff;
}

/* ============================================
   Content & Other Sections
   ============================================ */
.content-section {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin: 2rem 0;
}

.content-section h2 {
    color: #0066ff;
}

.content-section p, .content-section li {
    line-height: 1.7;
    color: #333;
}

.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.faq-question {
    font-weight: 600;
    font-size: 1.1rem;
}

.related-calculators {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.related-link {
    display: block;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: #1a1a1a;
    font-weight: 500;
    transition: all 0.3s;
    border: 1px solid #e9ecef;
}

.related-link:hover {
    background: #0066ff;
    color: white;
}


/* ============================================
   Footer
   ============================================ */
footer {
    background: #1a1a1a;
    color: #ccc;
    text-align: center;
    padding: 2.5rem 0;
    margin-top: 4rem;
}

footer p {
    margin: 0.5rem 0;
}

footer a {
    color: #0099ff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}


/* ============================================
   Ad Containers
   ============================================ */
.ad-container {
    margin: 2.5rem auto;
    text-align: center;
    min-height: 90px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ============================================
   Responsive Design
   ============================================ */
/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 280px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    z-index: 1000;
    top: 100%;
    left: 0;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    max-height: 400px;
    overflow-y: auto;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    color: #555;
    text-decoration: none;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-radius: 5px;
    margin-bottom: 0.2rem;
    border-left: 3px solid transparent;
}

.dropdown-content a:hover {
    color: #0066ff;
    background-color: #f0f8ff;
    border-left-color: #0066ff;
    transform: translateX(3px);
}

/* ============================================
   Mobile Navigation
   ============================================ */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    /* Mobile Header */
    header .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 20px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Mobile Navigation */
    nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #0066ff;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        z-index: 999;
    }
    
    nav.active {
        display: flex;
    }
    
    nav a {
        padding: 0.8rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
    }
    
    nav a:last-child {
        border-bottom: none;
    }
    
    /* Mobile Dropdowns */
    .dropdown {
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .dropdown-toggle {
        display: block;
        width: 100%;
        text-align: center;
        padding: 0.8rem;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 5px;
        margin-bottom: 0.5rem;
    }
    
    .dropdown-content {
        position: static;
        display: none;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: none;
        border-radius: 5px;
        margin-top: 0.5rem;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .dropdown.active .dropdown-content {
        display: block;
    }
    
    .dropdown-content a {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        border-left: none;
        border-bottom: 1px solid #eee;
    }
    
    .dropdown-content a:last-child {
        border-bottom: none;
    }
    
    /* Mobile Content */
    .hero h2 { font-size: 2rem; }
    .grid { grid-template-columns: 1fr; }
    .calculator-card { padding: 1.5rem; }
    .content-section { padding: 1.5rem; }
    
    /* Mobile Calculator Forms */
    .calculator-form {
        padding: 1rem;
    }
    
    .input-group {
        margin-bottom: 1rem;
    }
    
    .input-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
    }
    
    .input-group input,
    .input-group select {
        width: 100%;
        padding: 0.8rem;
        border: 2px solid #ddd;
        border-radius: 5px;
        font-size: 1rem;
    }
    
    .calculate-btn {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    /* Mobile Results */
    .result-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .result-item {
        text-align: center;
        padding: 1rem;
    }
    
    /* Mobile Ad Containers */
    .ad-container {
        margin: 1rem 0;
        text-align: center;
    }
    
    .ad-desktop {
        display: none;
    }
    
    .ad-mobile {
        display: block;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    header .container {
        padding: 0.8rem 15px;
    }
    
    .logo-image {
        width: 35px;
        height: 35px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }
    
    .calculator-header {
        padding: 1rem 0;
    }
    
    .calculator-header h1 {
        font-size: 1.8rem;
    }
    
    .breadcrumbs {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .content-section {
        padding: 1rem 0;
    }
    
    .faq-section {
        padding: 1rem 0;
    }
    
    .related-calculators {
        padding: 1rem 0;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .related-link {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Mobile Button Improvements */
    .calculate-btn {
        min-height: 48px;
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    /* Mobile Form Improvements */
    .input-group input,
    .input-group select {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Mobile Dropdown Improvements */
    .dropdown-content {
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Mobile Touch Targets */
    .dropdown-toggle,
    .mobile-menu-toggle {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile Navigation Improvements */
    nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile Ad Improvements */
    .ad-container {
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}