/* ========================================
   A Miracle Home Care — Styles v2.0
   Refactored & Enhanced
   ======================================== */

/* ===== CSS Variables ===== */
:root {
    --primary: #1B4F72;
    --primary-dark: #154360;
    --primary-light: #2E86C1;
    --accent: #E67E22;
    --accent-hover: #D35400;
    --accent-light: #F5B041;
    --success: #27AE60;
    --light-bg: #F8F9FA;
    --dark-bg: #1a1a2e;
    --text-dark: #2C3E50;
    --text-body: #495057;
    --text-muted: #5a6268;
    --white: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--primary-light) 100%);
    --gradient-dark: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}

/* ===== Base ===== */
* {
    scroll-behavior: smooth;
}

html {
    overflow-x: clip;
}

body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Skip to main content — accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: top 0.2s;
}

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

h1, h2, h3, h4, h5, h6 { color: var(--text-dark); }
.fw-800 { font-weight: 800 !important; }

/* Improved text-muted contrast */
.text-muted { color: var(--text-muted) !important; }
.bg-light .text-muted,
.bg-light p.text-muted { color: var(--text-body) !important; }

/* ===== Utility Classes ===== */
.icon-box-sm {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.icon-box-md {
    width: 64px;
    height: 64px;
    min-width: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Icon containers — light neutral bg so colored icons pop */
.icon-circle-light { background: #EBF5FB; border: 1px solid #D4E6F1; }
.icon-circle-warm  { background: #FEF5E7; border: 1px solid #FDEBD0; }
.icon-circle-green { background: #EAFAF1; border: 1px solid #D5F5E3; }

.section-heading {
    margin-bottom: 3rem;
    text-align: center;
}

.section-heading .badge {
    font-size: 0.8rem;
    font-weight: 600;
}

.star-rating { color: var(--accent); }

.img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-img-height {
    height: 220px;
    overflow: hidden;
}

/* ===== Colors & Buttons ===== */
.bg-primary { background-color: var(--primary) !important; }
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }
.bg-accent { background-color: var(--accent) !important; }
.text-accent-light { color: var(--accent-light) !important; }
.text-white-90 { color: rgba(255, 255, 255, 0.95) !important; }
.text-white-75 { color: rgba(255, 255, 255, 0.78) !important; }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--white);
    border: none;
    font-weight: 600;
    transition: var(--transition);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--accent-hover), #C0392B);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(230, 126, 34, 0.4);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ===== Top Bar ===== */
.top-bar {
    background: var(--gradient-primary) !important;
    font-size: 14px;
}

.top-bar a {
    transition: opacity 0.2s;
}

.top-bar a:hover { opacity: 0.8; }

/* ===== Navbar ===== */
.navbar {
    padding: 12px 0;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.97) !important;
}

.navbar.scrolled {
    padding: 6px 0;
    box-shadow: var(--shadow-md) !important;
}

.navbar .nav-link {
    font-weight: 500;
    color: var(--text-dark);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}

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

/* Underline effect — desktop only */
@media (min-width: 992px) {
    .navbar .nav-link::after {
        content: '';
        position: absolute;
        bottom: 2px;
        left: 50%;
        width: 0;
        height: 2px;
        background: var(--accent);
        transition: var(--transition);
        transform: translateX(-50%);
    }

    .navbar .nav-link:hover::after,
    .navbar .nav-link.active::after {
        width: 60%;
    }
}

/* ===== Hero Section ===== */
.hero-section,
.careers-hero {
    position: relative;
    overflow: hidden;
}

.hero-section {
    background: var(--gradient-primary);
}

.careers-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1A5276 60%, var(--primary-light) 100%);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1;
}

/* Parallax background pattern */
.hero-parallax-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(46,134,193,0.1) 0%, transparent 40%);
    z-index: 0;
}

/* Floating particles for hero */
.hero-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.hero-particles span {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: particleFloat linear infinite;
}

.hero-particles span:nth-child(1) { left: 10%; animation-duration: 8s; animation-delay: 0s; }
.hero-particles span:nth-child(2) { left: 25%; animation-duration: 12s; animation-delay: 2s; width: 4px; height: 4px; }
.hero-particles span:nth-child(3) { left: 40%; animation-duration: 10s; animation-delay: 4s; }
.hero-particles span:nth-child(4) { left: 55%; animation-duration: 14s; animation-delay: 1s; width: 8px; height: 8px; }
.hero-particles span:nth-child(5) { left: 70%; animation-duration: 9s; animation-delay: 3s; }
.hero-particles span:nth-child(6) { left: 85%; animation-duration: 11s; animation-delay: 5s; width: 5px; height: 5px; }
.hero-particles span:nth-child(7) { left: 50%; animation-duration: 13s; animation-delay: 2.5s; width: 3px; height: 3px; }
.hero-particles span:nth-child(8) { left: 15%; animation-duration: 7s; animation-delay: 6s; width: 7px; height: 7px; }

@keyframes particleFloat {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

.hero-section h1,
.careers-hero h1 {
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.hero-section .lead,
.careers-hero .lead {
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

.hero-content {
    position: relative;
    z-index: 2;
}

.min-vh-75 { min-height: 75vh; }

.hero-wave {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    line-height: 0;
    z-index: 3;
}

.hero-wave svg {
    display: block;
    width: 100%;
    height: 100px;
}

.hero-image-wrapper {
    position: relative;
    display: inline-block;
}

.hero-image {
    max-height: 460px;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.15);
}

.hero-stat-card {
    position: absolute;
    bottom: -20px;
    left: -30px;
    animation: float 3s ease-in-out infinite;
    z-index: 2;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* ===== Trust Bar ===== */
.trust-bar {
    border-bottom: 1px solid #eee;
    position: relative;
}

.trust-item {
    position: relative;
    transition: var(--transition);
}

.trust-item:hover {
    transform: translateY(-2px);
}

.trust-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 30px;
    width: 1px;
    background: #ddd;
}

/* ===== Section Parallax Backgrounds ===== */
.parallax-section {
    position: relative;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Subtle animated gradient for sections */
.animated-gradient-bg {
    position: relative;
    overflow: hidden;
}

.animated-gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(27, 79, 114, 0.02) 25%,
        rgba(46, 134, 193, 0.03) 50%,
        rgba(27, 79, 114, 0.02) 75%,
        transparent 100%
    );
    animation: shimmer 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-25%); }
    50% { transform: translateX(25%); }
}

/* ===== Service Cards ===== */
.service-card {
    transition: var(--transition);
    border-radius: var(--radius-md) !important;
    overflow: hidden;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg) !important;
}

.service-card .card-img-height img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover .card-img-height img {
    transform: scale(1.08);
}

/* ===== How It Works ===== */
.step-card {
    position: relative;
    transition: var(--transition);
}

.step-card:hover {
    transform: translateY(-4px);
}

@media (min-width: 768px) {
    .step-connector {
        position: absolute;
        top: 32px;
        left: calc(50% + 40px);
        width: calc(100% - 80px);
        height: 2px;
        background: linear-gradient(to right, var(--primary), var(--primary-light), transparent);
    }
}

.step-number {
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.step-card:hover .step-number {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 8px 20px rgba(27, 79, 114, 0.3);
}

/* ===== Testimonials ===== */
.testimonial-card {
    transition: var(--transition);
    position: relative;
}

.testimonial-card::before {
    content: '\201C';
    font-size: 80px;
    color: var(--primary);
    opacity: 0.08;
    position: absolute;
    top: 10px;
    left: 20px;
    font-family: Georgia, serif;
    line-height: 1;
}

/* ===== Careers CTA ===== */
.careers-cta {
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.careers-cta-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 30% 50%, rgba(255,255,255,0.05) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(255,255,255,0.03) 0%, transparent 50%);
}

/* ===== Contact Cards ===== */
.contact-section .card {
    transition: var(--transition);
}

.contact-section .card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

/* ===== Footer ===== */
.footer-logo {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

footer a.hover-white {
    transition: var(--transition);
}

footer a.hover-white:hover {
    color: var(--white) !important;
    padding-left: 4px;
}

/* ===== CTA Banner (footer) ===== */
.cta-banner {
    background: var(--gradient-primary) !important;
    position: relative;
    overflow: hidden;
}

.cta-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}

.cta-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

/* ===== Form Styles ===== */
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid #dee2e6;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(27, 79, 114, 0.15);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-floating > label { color: var(--text-muted); }

.form-section-title {
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

/* ===== Animations ===== */
.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
    opacity: 0;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Scroll reveal with multiple directions */
.reveal {
    opacity: 0;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.reveal-up { transform: translateY(40px); }
.reveal.reveal-left { transform: translateX(-40px); }
.reveal.reveal-right { transform: translateX(40px); }
.reveal.reveal-scale { transform: scale(0.9); }

.reveal.revealed {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger children animation */
.stagger-children .reveal:nth-child(1) { transition-delay: 0.05s; }
.stagger-children .reveal:nth-child(2) { transition-delay: 0.1s; }
.stagger-children .reveal:nth-child(3) { transition-delay: 0.15s; }
.stagger-children .reveal:nth-child(4) { transition-delay: 0.2s; }
.stagger-children .reveal:nth-child(5) { transition-delay: 0.25s; }
.stagger-children .reveal:nth-child(6) { transition-delay: 0.3s; }

/* Counter animation */
.counter-value {
    display: inline-block;
    transition: var(--transition);
}

/* ===== Scroll to Top ===== */
.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(27, 79, 114, 0.3);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: var(--accent);
    transform: translateY(-3px) scale(1.05);
}

/* ===== Responsive ===== */
@media (max-width: 991px) {
    .hero-section .display-4,
    .careers-hero .display-4 {
        font-size: 2.2rem;
    }

    .min-vh-75 { min-height: auto; }
}

@media (max-width: 767px) {
    .hero-section,
    .careers-hero {
        text-align: center;
    }

    .hero-section .hero-content .d-flex,
    .careers-hero .d-flex {
        justify-content: center;
    }

    .hero-section .display-4,
    .careers-hero .display-4 {
        font-size: 1.8rem;
    }

    .display-6 { font-size: 1.6rem; }

    .trust-item::after { display: none; }

    .step-connector { display: none; }

    /* Disable parallax on mobile for performance */
    .parallax-section { background-attachment: scroll; }

    /* Fix hero buttons stacking on small screens */
    .hero-section .btn-lg,
    .careers-hero .btn-lg {
        font-size: 0.95rem;
        padding: 0.6rem 1.2rem;
    }

    .cta-banner .d-flex { flex-direction: column; align-items: center; }
}

/* Mobile navbar collapse */
@media (max-width: 991px) {
    .navbar-collapse {
        background: var(--white);
        padding: 1rem 0;
    }
}
