/* --- SOFDental Mobile-First Optimization --- */

:root {
    --primary: #1D9DB9;
    --primary-light: #00D5B7;
    --secondary: #008FD5;
    --accent: #f43f5e;
    --text-dark: #0f172a;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 70px; /* Space for mobile action bar */
}

/* --- Layout --- */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* --- SVGs & Icons --- */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
    flex-shrink: 0;
}

/* --- Language Switching --- */
body.es [lang="en"] { display: none !important; }
body.en [lang="es"] { display: none !important; }

span[lang], strong[lang], a[lang] {
    display: inline-block;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    color: var(--primary);
    font-weight: 700;
    line-height: 1.2;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; margin-bottom: 1rem; }
h3 { font-size: 1.4rem; }

/* --- Header & Nav --- */
header {
    height: 70px;
    display: flex;
    align-items: center;
    background: var(--glass);
    backdrop-filter: blur(8px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo img {
    height: 40px;
    width: auto;
}

.nav-links, .btn-cta {
    display: none !important; /* Desktop only */
}

.mobile-toggle {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-align: center;
}

.btn-primary {
    background: var(--secondary);
    color: var(--white);
    box-shadow: 0 10px 20px rgba(0, 212, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 212, 255, 0.3);
}

/* --- Hero Section --- */
.hero {
    padding: 120px 0 60px;
    background: var(--white);
    text-align: center;
}

.hero h1 span {
    display: block;
    color: var(--secondary);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin: 1.5rem 0;
}

.hero-cta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.hero-phones {
    font-size: 0.9rem;
    color: var(--text-light);
}

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.badge {
    background: rgba(0, 212, 255, 0.1);
    color: var(--secondary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hero-image {
    margin-top: 2rem;
    position: relative;
}

.hero-image img {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.floating-card {
    display: none; /* Hide on mobile to reduce clutter */
}

/* --- Services Grid --- */
.services { padding: 60px 0; background: var(--white); }

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

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.service-card {
    background: var(--white);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid #eef2f6;
    display: flex;
    flex-direction: column;
}

.service-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 450 / 350;
    object-fit: cover;
}

.service-card-content {
    padding: 1.2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* --- Pricing Table (Mobile Card Style) --- */
.price-table-container {
    margin-top: 2rem;
}

.price-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 1rem;
}

.price-table thead { display: none; }

.price-table tr {
    display: block;
    background: var(--white);
    padding: 1.2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
}

.price-table td {
    display: block;
    padding: 0;
}

.price-table td:first-child {
    font-weight: 700;
    margin-bottom: 1rem;
}

.price-table td:last-child {
    color: var(--secondary);
    font-weight: 700;
    font-size: 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.price-table td:last-child::before {
    content: attr(data-label);
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
}

/* --- Insurance Logos --- */
.logos-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 0;
}

.logo-item {
    height: 30px;
    filter: grayscale(1);
    opacity: 0.6;
}

/* --- About Section --- */
.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.info-item .icon {
    font-size: 2rem;
    color: var(--secondary);
}

/* --- Contact & Map --- */
.contact-section {
    padding: 60px 0;
    background: var(--primary);
    color: var(--white);
}

.contact-section h2 { color: var(--white); }

.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

.contact-form {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    color: var(--text-dark);
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 500; }
.form-group input, .form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.map-container {
    margin-top: 2rem;
}

/* --- Mobile Menu --- */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: var(--white);
    z-index: 2000;
    padding: 4rem 2rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.mobile-menu.active { right: 0; }

.close-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-nav-links {
    list-style: none;
    text-align: center;
}

.mobile-nav-links li { margin-bottom: 1.5rem; }
.mobile-nav-links a { font-size: 1.4rem; font-weight: 600; text-decoration: none; color: var(--text-dark); }

/* --- Action Bars & Buttons --- */
.mobile-action-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    z-index: 999;
    padding: 0.8rem;
    gap: 1rem;
}

.action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.2rem;
}

.call-btn { color: var(--primary); }
.book-btn { color: var(--white); background: var(--secondary); border-radius: 10px; padding: 0.4rem; }

.back-to-top {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: var(--secondary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 998;
}

.back-to-top.active { opacity: 1; visibility: visible; }

/* --- Desktop Overrides (min-width: 993px) --- */
@media (min-width: 993px) {
    body { padding-bottom: 0; }

    header { height: 90px; }
    header.scrolled { height: 70px; }

    .logo img { height: 50px; }
    header.scrolled .logo img { height: 40px; }

    .nav-links { display: flex !important; list-style: none; gap: 2rem; }
    .nav-links a { text-decoration: none; color: var(--text-dark); font-weight: 500; transition: var(--transition); }
    .nav-links a:hover { color: var(--secondary); }

    .btn-cta { display: inline-block !important; }
    .mobile-toggle { display: none; }

    .hero {
        padding: 180px 0 100px;
        text-align: left;
    }

    .hero-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
        align-items: center;
    }

    .hero h1 { font-size: 3.5rem; }
    .hero p { font-size: 1.25rem; }
    .hero-cta { flex-direction: row; justify-content: flex-start; }
    .hero-badges { justify-content: flex-start; }
    .hero-image { margin-top: 0; }
    .hero-image img { max-width: none; }

    .floating-card {
        display: flex;
        position: absolute;
        bottom: -20px;
        left: -20px;
        background: var(--white);
        padding: 1.5rem;
        border-radius: 20px;
        box-shadow: var(--shadow);
        align-items: center;
        gap: 1rem;
        animation: float 4s ease-in-out infinite;
    }

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

    .grid { grid-template-columns: repeat(3, 1fr); gap: 2rem; }

    .price-table-container {
        padding: 2rem;
        background: var(--white);
        border-radius: 30px;
        box-shadow: var(--shadow);
    }

    .price-table thead { display: table-header-group; }
    .price-table tr { display: table-row; background: none; padding: 0; box-shadow: none; border: none; }
    .price-table th, .price-table td { display: table-cell; padding: 1rem; text-align: left; border-bottom: 1px solid #f1f5f9; }
    .price-table th { background: var(--primary); color: var(--white); border-radius: 0; }
    .price-table tr:hover { background: var(--bg-light); }
    .price-table td:last-child { font-size: 1rem; color: var(--text-dark); display: table-cell; }
    .price-table td:last-child::before { display: none; }

    .info-item { flex-direction: row; text-align: left; }

    .contact-grid { grid-template-columns: 1fr 1fr; gap: 6rem; }

    .mobile-action-bar { display: none; }
    .back-to-top { bottom: 30px; right: 30px; width: 50px; height: 50px; }
}

/* --- Tablet Overrides (min-width: 769px) and max 992px --- */
@media (min-width: 769px) and (max-width: 992px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- WhatsApp Widget --- */
.wa-widget {
    position: fixed;
    bottom: 85px; /* Above mobile action bar */
    right: 20px;
    z-index: 2100;
    font-family: 'Outfit', sans-serif;
}

.wa-button {
    width: 60px;
    height: 60px;
    background-color: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.wa-button:hover {
    transform: scale(1.1);
}

.wa-button .notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background-color: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    display: none; /* Initially hidden */
}

.wa-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: none;
    flex-direction: column;
    transform-origin: bottom right;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.wa-header {
    background-color: #25D366;
    padding: 1rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wa-header .wa-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-header .wa-info i {
    font-size: 1.5rem;
}

.wa-header .wa-info span {
    font-weight: 600;
}

.wa-header .close-wa {
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
}

.wa-body {
    padding: 1.5rem;
    background-color: #f0f2f5;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wa-message {
    background: white;
    padding: 0.8rem 1rem;
    border-radius: 0 15px 15px 15px;
    font-size: 0.9rem;
    max-width: 85%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: relative;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-out;
}

.wa-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.wa-message::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    border-width: 0 10px 10px 0;
    border-style: solid;
    border-color: transparent white transparent transparent;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 5px 10px;
    background: #e1e9eb;
    border-radius: 10px;
    width: fit-content;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #919191;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.wa-footer {
    padding: 1rem;
    background: white;
    text-align: center;
}

.wa-send-btn {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    text-decoration: none;
    transition: var(--transition);
}

.wa-send-btn:hover {
    background-color: #1ebe57;
}

@media (min-width: 993px) {
    .wa-widget {
        bottom: 30px;
        right: 30px;
    }
}
