/* ============================================================
   CMW Physicians Grid Widget — Production CSS
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────── */
.cmw-physicians-section {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.cmw-physicians-section *,
.cmw-physicians-section *::before,
.cmw-physicians-section *::after {
    box-sizing: border-box;
}

/* ── Container ─────────────────────────────────────────── */
.cmw-physicians-inner {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

@media (min-width: 640px) {
    .cmw-physicians-inner {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* ── Section Header ────────────────────────────────────── */
.cmw-section-header {
    text-align: center;
    margin-bottom: 48px;
}

.cmw-section-subtitle {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #4A9ED6;
    margin: 0 0 12px 0;
    padding: 0;
    line-height: 1.4;
}

.cmw-section-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-weight: 700;
    color: #1B3A5C;
    font-size: clamp(28px, 5vw, 40px);
    margin: 0 0 16px 0;
    padding: 0;
    line-height: 1.2;
}

.cmw-section-description {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: #64748B;
    max-width: 672px;
    margin: 0 auto;
    padding: 0;
}

/* Center description when header is centered */
.cmw-section-header[style*="text-align: center"] .cmw-section-description,
.cmw-section-header .cmw-section-description {
    margin-left: auto;
    margin-right: auto;
}

/* ── Filter Bar ────────────────────────────────────────── */
.cmw-filter-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 32px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

@media (min-width: 640px) {
    .cmw-filter-bar {
        flex-direction: row;
        align-items: center;
    }
}

.cmw-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.cmw-filter-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 50px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #E2E8F0;
    background-color: #FFFFFF;
    color: #2D3748;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    outline: none;
    line-height: 1.4;
    -webkit-appearance: none;
    appearance: none;
}

.cmw-filter-pill:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #CBD5E1;
}

.cmw-filter-pill.cmw-active {
    background-color: #1B3A5C;
    color: #FFFFFF;
    border-color: #1B3A5C;
}

.cmw-filter-pill:focus-visible {
    outline: 2px solid #4A9ED6;
    outline-offset: 2px;
}

/* ── Location Dropdown ─────────────────────────────────── */
.cmw-location-dropdown {
    position: relative;
    flex-shrink: 0;
}

.cmw-location-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 50px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #E2E8F0;
    background-color: #FFFFFF;
    color: #2D3748;
    cursor: pointer;
    transition: border-color 0.15s ease;
    white-space: nowrap;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.cmw-location-toggle:hover {
    border-color: #CBD5E1;
}

.cmw-location-toggle:focus-visible {
    outline: 2px solid #4A9ED6;
    outline-offset: 2px;
}

.cmw-chevron {
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.cmw-location-dropdown.cmw-open .cmw-chevron {
    transform: rotate(180deg);
}

.cmw-location-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    width: 176px;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.cmw-location-dropdown.cmw-open .cmw-location-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cmw-location-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #2D3748;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.1s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.cmw-location-option:hover {
    background-color: #F8FAFC;
}

.cmw-location-option.cmw-loc-active {
    font-weight: 700;
    color: #1B3A5C;
}

/* ── Filter Summary ────────────────────────────────────── */
.cmw-filter-summary {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #94A3B8;
    margin: 0 0 24px 0;
    padding: 0;
    line-height: 1.5;
}

.cmw-filter-summary .cmw-clear-link {
    color: #1B3A5C;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    font: inherit;
    padding: 0;
    transition: opacity 0.15s ease;
}

.cmw-filter-summary .cmw-clear-link:hover {
    opacity: 0.7;
}

/* ── Doctors Grid ──────────────────────────────────────── */
.cmw-doctors-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

@media (max-width: 1279px) {
    .cmw-doctors-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1023px) {
    .cmw-doctors-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .cmw-doctors-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Doctor Card ───────────────────────────────────────── */
.cmw-doctor-card {
    background-color: #FFFFFF;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.cmw-doctor-card:hover {
    box-shadow: 0 10px 40px -5px rgba(27, 58, 92, 0.15);
    transform: translateY(-4px);
}

.cmw-doctor-card.cmw-hidden {
    display: none;
}

/* Animation for show/hide */
.cmw-doctor-card.cmw-animating-out {
    animation: cmwFadeOut 0.25s ease forwards;
}

.cmw-doctor-card.cmw-animating-in {
    animation: cmwFadeIn 0.35s ease forwards;
}

@keyframes cmwFadeOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(8px) scale(0.97); }
}

@keyframes cmwFadeIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Card Photo ────────────────────────────────────────── */
.cmw-doctor-photo {
    position: relative;
    overflow: hidden;
    height: 220px;
    background-color: #F1F5F9;
}

.cmw-doctor-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 0.5s ease;
    display: block;
}

.cmw-doctor-card:hover .cmw-doctor-photo img {
    transform: scale(1.03);
}

/* ── Badges ────────────────────────────────────────────── */
.cmw-badge {
    position: absolute;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 4px 10px;
    border-radius: 50px;
    line-height: 1.4;
    white-space: nowrap;
    z-index: 2;
}

.cmw-badge-specialty {
    top: 12px;
    left: 12px;
    color: #FFFFFF;
}

.cmw-badge-location {
    top: 12px;
    right: 12px;
    background-color: rgba(255, 255, 255, 0.93);
    color: #1B3A5C;
}

/* ── Card Content ──────────────────────────────────────── */
.cmw-doctor-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px;
}

.cmw-doctor-name {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #1B3A5C;
    margin: 0;
    padding: 0;
}

.cmw-doctor-desc {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    line-height: 1.65;
    color: #64748B;
    margin: 10px 0 0 0;
    padding: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Card Divider ──────────────────────────────────────── */
.cmw-card-divider {
    height: 1px;
    background-color: #E2E8F0;
    margin-top: 16px;
    margin-bottom: 16px;
    width: 100%;
}

/* ── Profile Button ────────────────────────────────────── */
.cmw-btn-profile {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #FFFFFF;
    background-color: #1B3A5C;
    padding: 10px 0;
    border-radius: 8px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    line-height: 1.4;
}

.cmw-btn-profile:hover {
    background-color: #24527A;
    color: #FFFFFF;
    text-decoration: none;
}

.cmw-btn-profile:focus-visible {
    outline: 2px solid #4A9ED6;
    outline-offset: 2px;
}

/* ── Appointment Link ──────────────────────────────────── */
.cmw-btn-appointment {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #4A9ED6;
    padding: 6px 0;
    margin-top: 8px;
    transition: color 0.15s ease, opacity 0.15s ease;
    line-height: 1.4;
}

.cmw-btn-appointment:hover {
    color: #1B3A5C;
    text-decoration: none;
    opacity: 0.85;
}

.cmw-btn-appointment:focus-visible {
    outline: 2px solid #4A9ED6;
    outline-offset: 2px;
}

/* ── Empty State ───────────────────────────────────────── */
.cmw-empty-state {
    text-align: center;
    padding: 80px 20px;
}

.cmw-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    line-height: 1;
}

.cmw-empty-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #94A3B8;
    margin: 0 0 16px 0;
}

.cmw-clear-all {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #1B3A5C;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.cmw-clear-all:hover {
    opacity: 0.7;
}

/* ── View All CTA ──────────────────────────────────────── */
.cmw-view-all-wrap {
    text-align: center;
    margin-top: 56px;
}

.cmw-view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    border-radius: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #1B3A5C;
    background-color: transparent;
    border: 2px solid #1B3A5C;
    text-decoration: none;
    transition: all 0.25s ease;
    line-height: 1.4;
}

.cmw-view-all-btn:hover {
    background-color: #1B3A5C;
    color: #FFFFFF;
    text-decoration: none;
}

.cmw-view-all-btn:hover svg {
    stroke: #FFFFFF;
}

.cmw-view-all-btn:focus-visible {
    outline: 2px solid #4A9ED6;
    outline-offset: 2px;
}

.cmw-view-all-btn svg {
    flex-shrink: 0;
    transition: stroke 0.25s ease;
}

/* ── Accessibility ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .cmw-doctor-card,
    .cmw-doctor-photo img,
    .cmw-filter-pill,
    .cmw-btn-profile,
    .cmw-btn-appointment,
    .cmw-view-all-btn,
    .cmw-location-menu,
    .cmw-chevron {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }

    .cmw-doctor-card:hover {
        transform: none !important;
    }

    .cmw-doctor-card:hover .cmw-doctor-photo img {
        transform: none !important;
    }
}

/* ── Print ─────────────────────────────────────────────── */
@media print {
    .cmw-filter-bar,
    .cmw-filter-summary,
    .cmw-empty-state,
    .cmw-view-all-wrap {
        display: none !important;
    }

    .cmw-doctors-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    .cmw-doctor-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }

    .cmw-doctor-card:hover {
        transform: none !important;
    }
}