/* Scoped box-sizing - only affects medication pages */
body.medication-single-page *,
body.medication-single-page *::before,
body.medication-single-page *::after {
    box-sizing: border-box;
}

/* Center page body: full viewport width, then constrain and center content column */
body.medication-single-page {
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    padding: 20px;
    background: #f8f9fa;
}

/* 🟨 Consolidated medication page: constrain body and container width (same as single) */
body.medication-consolidated-page,
body.medication-consolidated-page .medication-page-container {
    box-sizing: border-box;
}
body.medication-consolidated-page {
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    padding: 20px;
    background: #f8f9fa;
}
body.medication-consolidated-page .medication-page-container {
    width: 100%;
    max-width: 100%;
}

/* Layout Wrapper */
.medication-page-wrapper {
    background: #f8f9fa;
}

/* Header */
.page-header {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-bottom: 3px solid #f0f2f5;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
}

/* ✅ NEW: Medication image in header */
.page-header-image {
    flex-shrink: 0;
}
.page-header-image img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}
.page-header-content {
    flex: 1;
    min-width: 0;
}

.page-header h1 {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-size: 1.8rem;
    line-height: 1.3;
}

.breadcrumb {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 16px;
}

.breadcrumb a {
    color: #2196f3;
    text-decoration: none;
}

/* Subtitle Section */
.med-subtitle-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.med-subtitle-ar {
    margin: 0;
    color: #1e293b;
    font-size: 1.15rem;
    font-family: 'Cairo', sans-serif;
    text-align: right;
    line-height: 1.6;
    order: 1;
}

.med-subtitle {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
    order: 2;
}

/* Hero Box Layout */
.header-hero-box {
    margin-top: 25px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Price box gradient – critical for hero layout */
.price-highlight {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    padding: 24px;
    border-radius: 12px;
    min-width: 300px;
    flex: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
}

.price-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.price-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.95rem;
}

.price-label-ar {
    font-family: 'Cairo';
    color: #475569;
    font-size: 0.9rem;
}

.price-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #0f172a;
    margin: 10px 0;
    letter-spacing: -0.02em;
}

.price-currency {
    font-size: 1.3rem;
    font-weight: 600;
    color: #64748b;
}

.price-note {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
}

.price-note-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-freshness {
    color: #10b981;
    font-weight: 600;
}

/* Status Badges */
.status-badges {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    min-width: 280px;
}

.badge-reimbursement {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.badge-reimbursement-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reimbursement-source {
    font-size: 0.85rem;
    opacity: 0.9;
    padding-top: 4px;
    color: #065f46;
}

/* Quick Info Pills */
.quick-info-pills {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Critical: prescription badge dynamism */
.prescription-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.prescription-ar {
    font-family: 'Cairo', sans-serif;
    margin-left: 8px;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* RTL support for prescription badge Arabic text */
[dir="rtl"] .prescription-ar {
    margin-left: 0;
    margin-right: 8px;
}

.info-pill {
    background: #f1f5f9;
    color: #475569;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.commercialized-pill {
    background: #dcfce7;
    color: #166534;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Sections */
.content-section {
    background: white;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.content-section h2 {
    margin: 0 0 20px 0;
    color: #1a3d6d;
    font-size: 1.5rem;
    border-bottom: 2px solid #2196f3;
    padding-bottom: 8px;
}

.content-section h3 {
    margin: 20px 0 12px 0;
    color: #333;
    font-size: 1.2rem;
}

/* Data Grid */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.data-item {
    padding: 12px;
    border-left: 3px solid #2196f3;
    background: #f5f9ff;
    border-radius: 4px;
}

.data-item-label {
    font-weight: 600;
    color: #1565c0;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 4px;
}

.data-item-value {
    color: #333;
    font-size: 1rem;
}

/* Report Error Link */
.report-error-container {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.report-error-subtle-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    padding: 6px 12px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.report-error-subtle-link:hover {
    color: #3b82f6;
    border-color: #3b82f6;
    background: #eff6ff;
}

.report-error-icon {
    margin-right: 6px;
    font-size: 1rem;
}

/* Insurance cards – responsive grid */
.insurance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.insurance-card {
    border: 2px solid;
    border-radius: 8px;
    padding: 20px;
}

.insurance-card.cnops {
    border-color: #2196f3;
    background: #f0f9ff;
}

.insurance-card.cnss {
    border-color: #ff6b35;
    background: #fff5f0;
}

.insurance-card h3 {
    margin: 0 0 16px 0;
    font-size: 1.3rem;
}

.insurance-detail {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.insurance-detail:last-child {
    border-bottom: none;
}

.status-yes {
    color: #4caf50;
    font-weight: 700;
}

.calculation-box {
    background: #fffbf0;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 16px;
    margin-top: 16px;
}

.calculation-content {
    margin-top: 8px;
    line-height: 1.8;
}

/* Content blocks */
.indication-box {
    background: #f5f9ff;
    border-left: 4px solid #2196f3;
    padding: 16px;
    border-radius: 4px;
    margin: 16px 0;
}

.indication-box[lang="ar"] {
    direction: rtl;
    text-align: right;
    border-left: none;
    border-right: 4px solid #2196f3;
}

.indication-title-ar {
    margin: 0 0 10px 0;
    color: #1a3d6d;
    font-family: 'Cairo';
}

.indication-content-ar {
    font-size: 1.1em;
    line-height: 1.8;
    color: #2d3748;
}

.official-notice {
    background: #fafafa;
    border-left: 4px solid #94a3b8;
    opacity: 0.9;
}

.notice-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.notice-content {
    color: #475569;
    font-size: 0.95rem;
}

/* Pharmacy CTA Grid */
.pharmacy-cta-container {
    text-align: center;
    margin: 45px 0 30px;
    padding: 0 15px;
}

.pharmacy-cta-title {
    margin-bottom: 20px;
    color: #1e293b;
    font-size: 1.2rem;
    font-weight: 700;
}

.pharmacy-cta-title-sub {
    display: block;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 4px;
}

.city-links-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.city-cta-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #ffffff;
    color: #1e293b;
    padding: 14px 18px;
    border-radius: 14px;
    text-decoration: none;
    min-width: 130px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.city-cta-btn:hover {
    background: #f8fafc;
    border-color: #2563eb;
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
}

.city-name {
    font-weight: 700;
    font-size: 1rem;
    color: #2563eb;
}

.city-name-ar {
    direction: rtl;
    font-family: 'Cairo';
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 2px;
}

.all-cities-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #ffffff;
    padding: 14px 22px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    min-width: 130px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.all-cities-btn:hover {
    background: #1d4ed8;
    transform: translateY(-3px);
}

.pharmacy-cta-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #ffffff;
    padding: 18px 30px;
    border-radius: 16px;
    text-decoration: none;
    min-width: 280px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
}

.pharmacy-cta-btn:hover {
    background: #1d4ed8;
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.pharmacy-cta-title-ar {
    font-family: 'Cairo', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0;
}

.pharmacy-cta-title-sub-en {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

/* FAQ */
.faq-item {
    margin: 16px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.faq-question {
    font-weight: 600;
    color: #1a3d6d;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.faq-answer {
    color: #555;
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 768px) {
    .header-hero-box {
        flex-direction: column;
    }
    .page-header h1 { font-size: 1.5rem; }
    .price-value { font-size: 2rem; }
    .data-grid { grid-template-columns: 1fr; }
}
