/* ============================================
   UNIT RATES - MAIN STYLESHEET
   styles.css - Link this to all your pages
   ============================================ */

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

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; 
    line-height: 1.6; 
    color: #333;
    max-width: 100%;
    overflow-x: hidden;
}

/* Content wrapper - applies to body content if no main tag */
body > h1,
body > h2,
body > h3,
body > p,
body > ul,
body > ol,
body > .calculator,
body > table {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

header { 
    background: #2c3e50; 
    color: white; 
    padding: 15px 0; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

.header-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.logo { 
    font-size: 1.5em; 
    font-weight: bold; 
    color: white; 
    text-decoration: none; 
}

.logo:hover {
    color: #3498db;
}

.mobile-menu-btn { 
    display: none; 
    background: none; 
    border: none; 
    color: white; 
    font-size: 1.5em; 
    cursor: pointer; 
    padding: 5px 10px;
}

nav ul { 
    list-style: none; 
    display: flex; 
    gap: 20px; 
}

nav li {
    margin: 0;
}

nav a { 
    color: white; 
    text-decoration: none; 
    padding: 8px 15px; 
    border-radius: 4px; 
    transition: background 0.3s; 
    display: block;
}

nav a:hover { 
    background: rgba(255,255,255,0.1); 
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .mobile-menu-btn { 
        display: block; 
    }
    
    nav { 
        display: none; 
        position: absolute; 
        top: 100%; 
        left: 0; 
        right: 0; 
        background: #34495e; 
        padding: 20px; 
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    nav.active { 
        display: block; 
    }
    
    nav ul { 
        flex-direction: column; 
        gap: 0; 
    }
    
    nav li { 
        border-bottom: 1px solid rgba(255,255,255,0.1); 
    }
    
    nav li:last-child {
        border-bottom: none;
    }
    
    nav a { 
        display: block; 
        padding: 15px; 
    }
}

/* ============================================
   MAIN CONTENT
   ============================================ */

main { 
    max-width: 900px; 
    margin: 40px auto; 
    padding: 0 20px;
    width: 100%;
}

/* Ensure body doesn't overflow */
body {
    max-width: 100%;
    overflow-x: hidden;
}

h1 { 
    color: #2c3e50; 
    font-size: 2em; 
    margin-bottom: 15px;
    max-width: 100%;
}

h2 { 
    color: #34495e; 
    margin-top: 30px; 
    border-bottom: 2px solid #3498db; 
    padding-bottom: 5px; 
    margin-bottom: 15px;
    max-width: 100%;
}

h3 { 
    color: #34495e; 
    margin-top: 20px; 
    margin-bottom: 10px; 
}

p { 
    margin-bottom: 15px; 
}

ul { 
    margin: 15px 0 15px 30px; 
}

ol {
    margin: 15px 0 15px 30px;
}

li { 
    margin-bottom: 8px; 
}

a {
    color: #1a5490;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

strong {
    font-weight: 600;
}

/* ============================================
   CALCULATOR STYLES
   ============================================ */

.calculator { 
    background: #f8f9fa; 
    padding: 25px; 
    border-radius: 8px; 
    margin: 20px auto; 
    border: 1px solid #ddd;
    max-width: 900px;
}

.form-group { 
    margin-bottom: 15px; 
}

label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: 600; 
    color: #34495e;
}

input, 
select, 
textarea { 
    width: 100%; 
    padding: 10px; 
    border: 2px solid #ddd; 
    border-radius: 4px; 
    font-size: 16px; 
    box-sizing: border-box; 
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
}

button { 
    background: #2471a3; 
    color: white; 
    padding: 12px 30px; 
    border: none; 
    border-radius: 4px; 
    font-size: 16px; 
    cursor: pointer; 
    width: 100%; 
    font-weight: 600;
    transition: background 0.3s;
}

button:hover { 
    background: #1a5490; 
}

.result { 
    margin-top: 20px; 
    padding: 20px; 
    background: #e8f5e9; 
    border-radius: 8px; 
    display: none; 
    font-size: 1.2em; 
    font-weight: bold; 
    color: #2e7d32; 
}

/* ============================================
   TABLES
   ============================================ */

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin: 20px 0; 
}

td, th { 
    padding: 10px; 
    border: 1px solid #ddd; 
    text-align: left;
}

th {
    background: #f8f9fa;
    font-weight: 600;
}

td:first-child, 
th:first-child { 
    font-weight: bold; 
}

tr:hover {
    background: #f8f9fa;
}

/* ============================================
   SPECIAL BOXES
   ============================================ */

.warning-box { 
    background: #fff3cd; 
    border: 3px solid #ffc107; 
    border-radius: 8px; 
    padding: 25px; 
    margin: 30px 0; 
}

.warning-box h2,
.warning-box h3 { 
    color: #856404; 
    margin-top: 0;
    border: none;
    padding: 0;
}

.warning-box p { 
    color: #856404; 
}

.info-box { 
    background: #e3f2fd; 
    border-left: 4px solid #2196f3; 
    padding: 20px; 
    margin: 20px 0; 
    border-radius: 4px; 
}

/* ============================================
   METADATA
   ============================================ */

.metadata { 
    font-size: 14px; 
    color: #6c757d; 
    margin-top: 30px; 
    padding-top: 15px; 
    border-top: 1px solid #dee2e6; 
}

/* ============================================
   FOOTER
   ============================================ */

footer { 
    background: #2c3e50; 
    color: white; 
    padding: 40px 20px 20px; 
    margin-top: 60px; 
}

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

.footer-links { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 30px; 
    margin-bottom: 30px; 
}

.footer-links h3 { 
    margin-bottom: 15px; 
    font-size: 1.1em; 
    border: none; 
    padding: 0; 
    color: white;
    margin-top: 0;
}

.footer-links ul { 
    list-style: none; 
    margin: 0; 
}

.footer-links li {
    margin-bottom: 5px;
}

.footer-links a { 
    color: #bdc3c7; 
    text-decoration: none; 
    display: block; 
    padding: 5px 0; 
}

.footer-links a:hover { 
    color: white; 
    text-decoration: none;
}

.footer-bottom { 
    border-top: 1px solid #34495e; 
    padding-top: 20px; 
    text-align: center; 
    color: #bdc3c7; 
    font-size: 0.9em; 
}

.footer-bottom p {
    margin-bottom: 5px;
}

/* ============================================
   HERO SECTION (for homepage)
   ============================================ */

.hero { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    color: white; 
    padding: 80px 20px; 
    text-align: center; 
    width: 100%;
}

.hero h1 { 
    font-size: 2.5em; 
    margin-bottom: 20px; 
    color: white;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.hero p { 
    font-size: 1.2em; 
    max-width: 600px; 
    margin: 0 auto 30px; 
}

/* ============================================
   CALCULATOR GRID (for homepage)
   ============================================ */

.section-title { 
    text-align: center; 
    font-size: 2em; 
    color: #2c3e50; 
    margin-bottom: 40px; 
}

.calculator-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 25px; 
    margin-bottom: 60px; 
}

.calculator-card { 
    background: white; 
    border: 2px solid #e0e0e0; 
    border-radius: 8px; 
    padding: 25px; 
    text-decoration: none; 
    color: #333; 
    transition: all 0.3s; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

.calculator-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); 
    border-color: #2471a3; 
    text-decoration: none;
}

.calculator-card h3 { 
    color: #2c3e50; 
    font-size: 1.3em; 
    margin-bottom: 10px; 
}

.calculator-card p { 
    color: #666; 
    font-size: 0.95em; 
    line-height: 1.5; 
    margin-bottom: 0;
}

.calculator-icon { 
    font-size: 2.5em; 
    margin-bottom: 15px; 
    display: block;
}

/* ============================================
   FEATURES SECTION (for homepage)
   ============================================ */

.features { 
    background: #f8f9fa; 
    padding: 60px 20px; 
    margin: 60px 0;
}

.features-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 30px; 
    max-width: 1200px; 
    margin: 0 auto; 
}

.feature { 
    text-align: center; 
}

.feature-icon { 
    font-size: 3em; 
    margin-bottom: 15px; 
    display: block;
}

.feature h3 { 
    color: #2c3e50; 
    margin-bottom: 10px; 
}

.feature p { 
    color: #666; 
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    main { 
        margin: 20px auto; 
        padding: 0 15px;
        max-width: 100%;
    }
    
    body > h1,
    body > h2,
    body > h3,
    body > p,
    body > ul,
    body > ol,
    body > .calculator,
    body > table {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    h1 { 
        font-size: 1.6em; 
    }
    
    h2 { 
        font-size: 1.3em; 
    }
    
    .hero h1 { 
        font-size: 1.8em; 
    }
    
    .hero p { 
        font-size: 1em; 
    }
    
    .hero {
        padding: 50px 20px;
    }
    
    .section-title { 
        font-size: 1.6em; 
    }
    
    .calculator-grid { 
        grid-template-columns: 1fr; 
    }
    
    .calculator { 
        padding: 20px;
        margin: 20px 15px;
    }
    
    footer { 
        padding: 30px 15px 15px; 
    }
    
    .footer-links { 
        grid-template-columns: 1fr; 
        gap: 20px; 
    }
    
    table {
        font-size: 0.9em;
    }
    
    td, th {
        padding: 8px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    header,
    footer,
    .mobile-menu-btn,
    button {
        display: none;
    }
    
    body {
        color: #000;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
}