/* =====================================================
   MEDOC - Design System Principal
   Medicina Ocupacional del Ecuador
   ===================================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
    --primary: #0A5C6B;
    --primary-light: #0E7A8D;
    --primary-dark: #073D48;
    --primary-rgb: 10, 92, 107;
    --accent: #F5A623;
    --accent-hover: #E09400;
    --accent-rgb: 245, 166, 35;
    --success: #25D366;
    --success-hover: #1DA851;
    --bg-light: #F8F9FA;
    --bg-cream: #FAFAF5;
    --bg-white: #FFFFFF;
    --text-dark: #1A1A2E;
    --text-body: #3D3D56;
    --text-muted: #6B7280;
    --text-light: #FFFFFF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --container: 1200px;
    --header-height: 80px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-body);
    background-color: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-light);
}

ul, ol {
    list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-dark);
    line-height: 1.25;
    font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 0.8rem; }
h3 { font-size: clamp(1.2rem, 3vw, 1.6rem); margin-bottom: 0.6rem; }
h4 { font-size: 1.2rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

.text-accent { color: var(--accent); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-uppercase { text-transform: uppercase; letter-spacing: 2px; font-size: 0.8rem; font-weight: 600; }

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Section Spacing --- */
.section {
    padding: 5rem 0;
}

.section--alt {
    background-color: var(--bg-light);
}

.section--dark {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: var(--text-light);
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
    color: var(--text-light);
}

.section__header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 3rem;
}

.section__label {
    display: inline-block;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    font-family: var(--font-body);
}

.section__subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.7;
}

/* --- Grid --- */
.grid {
    display: grid;
    gap: 2rem;
}

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

@media (max-width: 992px) {
    .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn--primary {
    background: var(--accent);
    color: var(--text-dark);
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.35);
}

.btn--primary:hover {
    background: var(--accent-hover);
    color: var(--text-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.45);
}

.btn--secondary {
    background: transparent;
    color: var(--text-light);
    border: 2px solid rgba(255,255,255,0.4);
}

.btn--secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.8);
    color: var(--text-light);
}

.btn--whatsapp {
    background: var(--success);
    color: var(--text-light);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.35);
}

.btn--whatsapp:hover {
    background: var(--success-hover);
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}

.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn--lg {
    padding: 1rem 2.5rem;
    font-size: 1.05rem;
}

.btn--sm {
    padding: 0.6rem 1.4rem;
    font-size: 0.85rem;
}

.btn svg, .btn i {
    font-size: 1.1em;
}

/* --- Cards --- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.card__icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), rgba(var(--primary-rgb), 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    color: var(--primary);
    font-size: 1.5rem;
}

.card__title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
    color: var(--text-dark);
}

.card__text {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.card__link {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.card__link:hover {
    gap: 0.6rem;
}

.card__link::after {
    content: '→';
    transition: all var(--transition);
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    transition: all var(--transition);
    background: transparent;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    padding: 0.6rem 0;
}

.navbar.scrolled .navbar__logo-text {
    color: var(--primary-dark);
}

.navbar.scrolled .navbar__link {
    color: var(--text-dark);
}

.navbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.navbar__logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    z-index: 1001;
}

.navbar__logo-icon {
    width: 42px;
    height: 42px;
}

.navbar__logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
    transition: color var(--transition);
}

.navbar__menu {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.navbar__link {
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    white-space: nowrap;
}

.navbar__link:hover,
.navbar__link.active {
    color: var(--accent);
}

.navbar.scrolled .navbar__link:hover,
.navbar.scrolled .navbar__link.active {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.06);
}

.navbar__cta {
    margin-left: 0.8rem;
}

/* Hamburger */
.navbar__toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.navbar__toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-light);
    border-radius: 2px;
    transition: all var(--transition);
}

.navbar.scrolled .navbar__toggle span {
    background: var(--text-dark);
}

.navbar__toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.navbar__toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar__toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Dropdown Navbar --- */
.navbar__dropdown {
    position: relative;
}

.navbar__dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition);
    border: 1px solid var(--border);
    z-index: 1002;
}

.navbar__dropdown:hover .navbar__dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar__dropdown-link {
    display: block;
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    color: var(--text-body) !important;
    transition: all var(--transition);
}

.navbar__dropdown-link:hover {
    background: var(--bg-light);
    color: var(--primary) !important;
    padding-left: 1.5rem;
}

/* --- Mobile Nav --- */
@media (max-width: 992px) {
    .navbar__toggle {
        display: flex;
    }

    .navbar__menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        background: var(--bg-white);
        flex-direction: column;
        align-items: flex-start;
        padding: 6rem 2rem 2rem;
        gap: 0;
        box-shadow: var(--shadow-xl);
        transition: right var(--transition);
        overflow-y: auto;
    }

    .navbar__menu.open {
        right: 0;
    }

    .navbar__link {
        color: var(--text-dark);
        width: 100%;
        padding: 0.8rem 0;
        border-bottom: 1px solid var(--border);
        font-size: 1rem;
    }

    .navbar__cta {
        margin-left: 0;
        margin-top: 1.5rem;
        width: 100%;
    }

    .navbar__cta .btn {
        width: 100%;
        justify-content: center;
    }

    .navbar__dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding: 0 0 0 1rem;
        display: none;
        min-width: auto;
    }

    .navbar__dropdown.open .navbar__dropdown-menu {
        display: block;
    }
}

/* Mobile overlay */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.nav-overlay.active {
    display: block;
}

/* --- Footer --- */
.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.85);
    padding: 4rem 0 0;
}

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

.footer__title {
    font-family: var(--font-heading);
    color: var(--text-light);
    font-size: 1.15rem;
    margin-bottom: 1.2rem;
}

.footer__text {
    font-size: 0.9rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.7);
}

.footer__links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer__link {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    transition: all var(--transition);
    padding: 0.15rem 0;
}

.footer__link:hover {
    color: var(--accent);
    padding-left: 0.3rem;
}

.footer__contact-item {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.footer__contact-icon {
    color: var(--accent);
    margin-top: 3px;
    flex-shrink: 0;
}

.footer__bottom {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
}

@media (max-width: 992px) {
    .footer__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .footer__grid {
        grid-template-columns: 1fr;
    }
}

/* --- CTA Section --- */
.cta-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 4rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

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

.cta-section h2 {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.cta-section p {
    color: rgba(255,255,255,0.85);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.cta-section .btn-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- WhatsApp Float --- */
.whatsapp-float {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 998;
    width: 60px;
    height: 60px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all var(--transition);
    animation: pulse-wa 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.5);
}

.whatsapp-float svg {
    width: 30px;
    height: 30px;
    fill: #fff;
}

@keyframes pulse-wa {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* --- Mobile CTA Bar --- */
.mobile-cta-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 997;
    background: var(--bg-white);
    box-shadow: 0 -2px 15px rgba(0,0,0,0.1);
    padding: 0.7rem 1rem;
}

.mobile-cta-bar__inner {
    display: flex;
    gap: 0.8rem;
}

.mobile-cta-bar__inner .btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
    .mobile-cta-bar {
        display: block;
    }

    .whatsapp-float {
        bottom: 5.5rem;
        right: 1.2rem;
        width: 50px;
        height: 50px;
    }

    .whatsapp-float svg {
        width: 26px;
        height: 26px;
    }
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.4rem;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-dark);
    background: var(--bg-white);
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%236B7280' d='M6 8L1 3h10z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-error {
    color: #dc2626;
    font-size: 0.8rem;
    margin-top: 0.3rem;
    display: none;
}

.form-group.error .form-control {
    border-color: #dc2626;
}

.form-group.error .form-error {
    display: block;
}

/* --- Breadcrumb --- */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.85rem;
}

.breadcrumb__list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.breadcrumb__item {
    color: var(--text-muted);
}

.breadcrumb__item a {
    color: var(--text-muted);
}

.breadcrumb__item a:hover {
    color: var(--primary);
}

.breadcrumb__separator {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* --- Page Header --- */
.page-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 8rem 0 3.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--bg-white);
    clip-path: polygon(0 100%, 100% 100%, 100% 0, 0 100%);
}

.page-header h1 {
    color: var(--text-light);
    margin-bottom: 0.8rem;
}

.page-header p {
    color: rgba(255,255,255,0.85);
    font-size: 1.1rem;
    max-width: 650px;
    margin: 0 auto;
}

/* --- Utilities --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* --- Responsive Base --- */
@media (max-width: 768px) {
    .section {
        padding: 3.5rem 0;
    }

    .page-header {
        padding: 7rem 0 3rem;
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
}
