/* ELECTRICAL CONTRACTOR TEMPLATE - Main Stylesheet */
/* ENHANCED: Now supports 6-color system with automatic contrast */

:root {
    /* Core brand colors - will be overridden by PHP inline styles or colors.css */
    --primary: #FFD700;
    --primary-text: #000000;    /* Text that goes ON primary */
    --secondary: #1E40AF;
    --accent: #0EA5E9;
    --accent-text: #000000;     /* Text that goes ON accent */
    --text: #1F2937;
    --text-light: #6B7280;
    --bg: #FFFFFF;
    --bg-light: #F9FAFB;
    --bg-dark: #111827;
    --emergency: #DC3545;
    --border: #E5E7EB;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 12px;
    
    /* Alias for compatibility with colors.css */
    --color-primary: var(--primary);
    --color-primary-text: var(--primary-text);
    --color-secondary: var(--secondary);
    --color-accent: var(--accent);
    --color-accent-text: var(--accent-text);
    --color-text: var(--text);
    --color-background: var(--bg);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: var(--bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    color: var(--primary-text);  /* ✅ FIXED: Now uses calculated contrast-safe color */
}
.btn-primary:hover { filter: brightness(0.9); text-decoration: none; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { 
    background: var(--primary); 
    color: var(--primary-text);  /* ✅ FIXED: Uses primary-text on hover */
    text-decoration: none; 
}
.btn-lg { padding: 16px 32px; font-size: 17px; }
.btn-block { width: 100%; justify-content: center; }

/* ========== EMERGENCY BANNER ========== */
.emergency-banner {
    background: var(--emergency);
    color: white;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.emergency-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}
.emergency-text {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: #fff;
}
.emergency-text i {
    font-size: 20px;
    animation: shake 0.5s infinite;
}
.emergency-btn {
    background: white;
    color: var(--emergency);
    padding: 10px 24px;
    border-radius: 25px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.emergency-btn:hover { text-decoration: none; transform: scale(1.05); }

@keyframes shake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

/* ========== HEADER ========== */
.header {
    background: var(--secondary);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 999;
}
.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--secondary-text);  /* Auto-calculated contrast */
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 24px;
    flex-shrink: 0;
}
.logo:hover { text-decoration: none; color: var(--secondary-text); }
.logo i { color: var(--primary); font-size: 28px; }

.nav {
    display: flex;
    gap: 8px;
    align-items: center;
}
.nav a {
    color: var(--secondary-text);
    opacity: 0.75;
    font-weight: 500;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.25s;
}
.nav a:hover { opacity: 1; background: rgba(0,0,0,0.1); text-decoration: none; }

/* "Start" button in nav — stands out with accent color */
.nav a.nav-start {
    background: var(--accent);
    color: var(--accent-text);  /* Auto-calculated contrast */
    font-weight: 700;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 1;
}
.nav a.nav-start:hover {
    filter: brightness(1.15);
    background: var(--accent);
    color: var(--accent-text);
    text-decoration: none;
}

.header-cta {
    background: var(--primary);
    color: var(--primary-text);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    text-decoration: none;
}
.header-cta:hover { filter: brightness(0.9); text-decoration: none; }

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--secondary-text);  /* Auto-calculated contrast */
    font-size: 24px;
    cursor: pointer;
}

/* ========== HERO ========== */
.hero {
    background: var(--secondary);
    color: var(--secondary-text);  /* Auto-calculated contrast-safe text */
    padding: 100px 0;
    text-align: center;
}
.hero-content { max-width: 800px; margin: 0 auto; }
.hero h1 { font-size: 48px; margin-bottom: 20px; color: var(--secondary-text); }
.hero p { font-size: 20px; opacity: 0.9; margin-bottom: 30px; color: var(--secondary-text); }
.hero-buttons { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.hero-badges {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}
.hero-badges span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.9;
    color: var(--secondary-text);
}
.hero-badges i { color: var(--primary); }

/* ========== SECTIONS ========== */
/* ========== SECTIONS - VISUAL VARIETY SYSTEM ========== */
/* Smart alternating backgrounds that work with ANY color palette */

.section { 
    padding: 80px 0; 
}

/* LIGHT SECTIONS - White/very light background, dark text */
.section-light { 
    background: #FFFFFF;
}
.section-light .section-header h2 { 
    font-size: 36px; 
    margin-bottom: 10px; 
    color: #1F2937;  /* Dark gray for light backgrounds */
}
.section-light .section-header p { 
    font-size: 18px; 
    color: #6B7280;  /* Medium gray for light backgrounds */
}

/* MEDIUM SECTIONS - Secondary color background, light text */
.section-dark { 
    background: var(--color-secondary, #1F2937);  /* Use theme secondary */
}
.section-dark .section-header h2 { 
    font-size: 36px; 
    margin-bottom: 10px; 
    color: var(--color-primary, #F7E700);  /* Primary color for visibility */
}
.section-dark .section-header p { 
    font-size: 18px; 
    color: var(--color-text, #F3F4F6);  /* Light text */
}

/* ACCENT SECTIONS - Accent color background with contrast text */
.section-accent {
    background: var(--color-accent, #00D4FF);
}
.section-accent .section-header h2 {
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--color-accent-text, #000000);  /* Contrast-safe text on accent */
}
.section-accent .section-header p {
    font-size: 18px;
    color: var(--color-accent-text, #000000);
    opacity: 0.8;
}

/* SPECIFIC SECTION OVERRIDES FOR VISUAL HIERARCHY */

/* Hero - Keep unique */
/* Services - Default/light */
#services {
    background: #F9FAFB;  /* Very light gray */
}

/* Projects - Secondary color (dark) */
#projects {
    background: var(--color-secondary, #1F2937);
}
#projects .section-header h2 {
    color: var(--color-primary, #F7E700);
}
#projects .section-header p {
    color: var(--color-text, #F3F4F6);
}

/* Service Area - Light */
#service_area {
    background: #FFFFFF;
}

/* Certifications - Dark with theme colors */
#certifications {
    background: var(--color-secondary, #111827);
}
#certifications .section-header h2 {
    color: var(--color-primary, #F7E700);
}
#certifications .section-header p {
    color: var(--color-text, #F3F4F6);
}

/* Contact - Accent color for CTA */
.section-contact { 
    background: var(--color-accent, #00D4FF);
}
.section-contact h2,
.section-contact p,
.section-contact .contact-item,
.section-contact .contact-item a {
    color: var(--color-accent-text, #000000) !important;  /* Use contrast-safe text */
}
.section-contact .contact-item i {
    color: var(--color-accent-text, #000000);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

/* ========== SERVICES GRID ========== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}
.service-card {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    border: 1px solid var(--border);
}
.service-card:hover { transform: translateY(-5px); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.service-card.emergency { border-left: 4px solid var(--emergency); }
.service-icon {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}
.service-icon i { 
    font-size: 28px; 
    color: var(--primary-text);  /* Uses calculated contrast */
}
.service-card h3 { 
    font-size: 20px; 
    margin-bottom: 10px; 
    color: #1F2937;  /* Always dark text on light card background */
}
.service-card p { 
    color: #6B7280;  /* Always medium gray on light card background */
    margin-bottom: 15px; 
}
.service-price { font-size: 18px; font-weight: 700; color: var(--accent); }
.emergency-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--emergency);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ========== PROJECTS GRID ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 25px;
}
.project-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: pointer;
    border: 1px solid var(--border);
}
.project-card img, .project-card .placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.project-card .placeholder {
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}
.project-card .placeholder i { font-size: 48px; color: var(--text-light); }
/* fallback placeholder: solid bg with icon */
.project-card .project-placeholder {
    background: var(--bg-light);
}
.project-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 40px 20px 20px;
    color: white;
}
.project-overlay h4 { font-size: 18px; margin-bottom: 5px; color: #fff; }
.project-overlay span { font-size: 13px; opacity: 0.8; color: rgba(255,255,255,0.8); }

/* Hide projects initially */
.project-hidden {
    display: none;
}

/* Smooth fade-in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-card.fade-in {
    animation: fadeInUp 0.5s ease forwards;
}

/* ========== ZIP CHECKER ========== */
.zip-checker-box {
    background: var(--secondary);
    color: var(--secondary-text);  /* Auto-calculated contrast */
    padding: 50px;
    border-radius: var(--radius);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid var(--border);
}
.zip-checker-box h3 { font-size: 24px; margin-bottom: 25px; color: var(--secondary-text); }
.zip-checker-box i { color: var(--primary); }
.zip-form {
    display: flex;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}
.zip-form input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    color: #111;
    background: #fff;
}
.zip-form button,
.zip-submit-btn {
    background: var(--primary);
    color: var(--primary-text) !important;
    border: none;
    padding: 15px 28px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    text-decoration: none;
    min-width: 120px;
}
.zip-form button:hover,
.zip-submit-btn:hover { 
    filter: brightness(0.9); 
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.zip-submit-btn i {
    font-size: 16px;
    color: inherit;
}
.zip-submit-btn span {
    font-weight: 700;
    font-size: 16px;
    color: inherit;
}
#zipResult {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    display: none;
    font-weight: 600;
}
#zipResult.success { 
    display: block; 
    background: rgba(40,167,69,0.25); 
    color: #86efac; 
}
#zipResult.success i.fa-check-circle {
    color: var(--accent);  /* Use accent color for the check icon */
    font-size: 20px;
    margin-right: 4px;
}
#zipResult.error { 
    display: block; 
    background: rgba(220,53,69,0.25); 
    color: #fca5a5; 
}
#zipResult.error i.fa-times-circle {
    color: #ef4444;
    font-size: 20px;
    margin-right: 4px;
}

/* ========== CERTIFICATIONS ========== */
.certs-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 40px;
}
.cert-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);  /* Slightly lighter than background */
    border: 1px solid rgba(255, 255, 255, 0.1);  /* Subtle border */
    border-radius: 16px;
    padding: 14px 12px 12px;
    min-width: 140px;
    transition: transform 0.25s, box-shadow 0.25s;
}
.cert-badge:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    background: rgba(255, 255, 255, 0.08);  /* Slightly brighter on hover */
}
.cert-badge img {
    width: 130px;
    height: 130px;
    object-fit: contain;
}
.cert-badge i { 
    font-size: 80px; 
    color: var(--color-primary, #F7E700);  /* Use theme primary color */
}
.cert-badge span { 
    font-size: 13px; 
    color: var(--color-text, #F3F4F6);  /* Use theme text color for visibility */
    max-width: 150px; 
    font-weight: 600; 
}
.cert-badge a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-accent, #00D4FF);  /* Use theme accent color */
    font-size: 11px;
    font-weight: 600;
}
.cert-badge a i {
    font-size: 10px;
    color: var(--color-accent, #00D4FF);  /* Use theme accent color */
}
}

/* ========== CONTACT SECTION ========== */
/* Contact section uses accent color - styling defined above in SECTIONS */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 50px;
    align-items: start;
}
.contact-info h2 { 
    font-size: 32px; 
    margin-bottom: 15px;
}
.contact-info p { 
    margin-bottom: 30px;
    opacity: 0.9;
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}
.contact-item i {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.1);  /* Subtle background */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.contact-item a { 
    color: #1F2937;  /* Always dark text */
    font-weight: 500; 
}
.contact-item a:hover { text-decoration: none; color: var(--accent); }
.contact-form {
    background: var(--bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.contact-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.contact-form input, .contact-form select, .contact-form textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 15px;
    font-family: inherit;
    background: #FFFFFF;
    color: #1F2937;  /* Always dark text on white background */
}
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}
.contact-form select option { background: var(--bg-light); color: #1F2937; }
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert.success { background: #d4edda; color: #155724; }
.alert.error   { background: #f8d7da; color: #721c24; }

/* ========== SOCIAL ICONS ========== */
.social-icons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px;
}
.social-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: 1px solid var(--border);
    color: var(--text-light);
    font-size: 16px;
    transition: all 0.25s;
    text-decoration: none;
}
.social-icon:hover {
    background: var(--brand-color, var(--accent));
    color: #fff;
    border-color: var(--brand-color, var(--accent));
    transform: translateY(-2px);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Footer social row — slightly smaller, inline */
.footer-social {
    justify-content: center;
    margin: 16px 0;
    gap: 8px;
}
.footer-social .social-icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
}
.footer-social .social-icon:hover {
    background: var(--brand-color, var(--accent));
    color: #fff;
    border-color: var(--brand-color, var(--accent));
}

/* ========== FOOTER ========== */
.footer {
    background: var(--secondary);
    color: var(--secondary-text);  /* Auto-calculated contrast */
    padding: 50px 0 30px;
}
.footer-content { text-align: center; }
.footer-logo {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--secondary-text);
}
.footer-logo i { color: var(--primary); }
.footer p { opacity: 0.7; font-size: 14px; color: var(--secondary-text); }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--secondary);
        flex-direction: column;
        padding: 20px;
        gap: 6px;
        align-items: stretch;
    }
    .nav.open { display: flex; }
    .nav a { text-align: center; }
    .mobile-toggle { display: block; }
    .header-cta { display: none; }

    .hero { padding: 60px 0; }
    .hero h1 { font-size: 32px; }
    .hero p { font-size: 16px; }
    .hero-badges { gap: 15px; }

    .section { padding: 50px 0; }
    .section-header h2 { font-size: 28px; }

    .services-grid { grid-template-columns: 1fr; }
    .projects-grid { grid-template-columns: 1fr; }

    .contact-wrapper { grid-template-columns: 1fr; gap: 30px; }
    .contact-form { padding: 25px; }
    .contact-form .form-row { grid-template-columns: 1fr; }

    .zip-checker-box { padding: 30px 20px; }
    .zip-form { flex-direction: column; }

    .emergency-content { justify-content: center; text-align: center; }

    .certs-grid { gap: 20px; }
}