/* **CRITICAL CSS** - Minimal above-the-fold styles for LCP optimization
   This file contains ONLY the essential styles needed for immediate render.
   Full styles are in railway-pharmacy.css loaded asynchronously. */

/* ===== LCP ELEMENT - Arabic Header ===== */
.pharmacy-header-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 3rem 2.5rem;
    text-align: center;
    border-radius: 20px;
    margin-bottom: 2.5rem;
    position: relative;
    min-height: 180px;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.15), 0 5px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.pharmacy-header-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 20px;
    pointer-events: none;
}

.pharmacy-header-section::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% { transform: rotate(0deg) translate(-50%, -50%); }
    50% { transform: rotate(180deg) translate(-50%, -50%); }
}

/* ===== Typography ===== */
.pharmacy-arabic-title {
    font-family: 'Amiri', 'Noto Kufi Arabic', 'Cairo', serif;
    font-size: 2.8rem;
    color: #ffffff;
    margin: 0;
    direction: rtl;
    line-height: 1.35;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.pharmacy-arabic-subtitle {
    font-family: 'Noto Kufi Arabic', 'Cairo', sans-serif;
    font-size: 1.35rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    direction: rtl;
    line-height: 1.6;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 2;
}

/* ===== Layout Elements ===== */
.city-selector-container {
    margin-bottom: 1.5rem;
    min-height: 50px;
}

/* Remove default list styling */
ul, ol, li {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ===== Pharmacy Finder Container ===== */
#pharmacy-finder-container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    background-color: transparent !important;
    border-radius: 0 !important;
}

#pharmacy-finder-container * {
    box-sizing: border-box;
}

#pharmacy-finder-container > * {
    margin-bottom: 7px;
}

#pharmacy-finder-container > *:last-child {
    margin-bottom: 0;
}

/* ===== Pharmacy Pages Table ===== */
.pharmacy-pages-table-container {
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.pharmacy-pages-header {
    font-family: 'Amiri', 'Noto Kufi Arabic', 'Cairo', serif;
    font-size: 1.8rem;
    color: #1e3d72;
    margin: 0 0 1.5rem 0;
    text-align: center;
    font-weight: 700;
    position: relative;
}

.pharmacy-pages-header::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.pharmacy-pages-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    /* HIGHLIGHT: Cleanup - rely on table's own rounded corners with overflow hidden */
}

.pharmacy-pages-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.pharmacy-pages-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: none;
    position: relative;
}

/* HIGHLIGHT: Cleanup - removed redundant th corner radii */

.pharmacy-pages-table tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.pharmacy-pages-table tbody tr:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.pharmacy-pages-table tbody tr:last-child {
    border-bottom: none;
}

/* HIGHLIGHT: Cleanup - removed redundant td corner radii at last row */

.pharmacy-pages-table td {
    padding: 1.25rem 1.5rem;
    border: none;
    font-size: 0.95rem;
    color: #2c3e50;
    vertical-align: middle;
}

.pharmacy-pages-table td:first-child {
    font-weight: 600;
    color: #1e3d72;
}

.pharmacy-pages-table td:nth-child(2) {
    color: #6c757d;
    font-size: 0.9rem;
}

.pharmacy-pages-table td:nth-child(3) {
    text-align: center;
    font-weight: 600;
    color: #28a745;
}

.view-pharmacies-btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #000000 !important;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
    border: none;
    cursor: pointer;
}

.view-pharmacies-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    color: #000000 !important;
}

.view-pharmacies-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.welcome-message {
    display: block;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 30px 25px;
    margin: 0 0 20px 0;
    text-align: center;
    min-height: 120px;
    position: relative;
}

.welcome-message.hidden {
    display: none !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.welcome-title {
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: 700;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.welcome-description {
    color: #495057;
    font-size: 1.1em;
    line-height: 1.6;
    margin: 0;
    font-weight: 400;
}

/* ===== Pharmacy Actions ===== */
.pharmacy-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-map,
.btn-whatsapp {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.btn-map {
    background: linear-gradient(135deg, #007cba 0%, #0056b3 100%);
    color: #ffffff;
}

.btn-map:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.3);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: #ffffff;
}

.btn-whatsapp:hover {
    background: linear-gradient(135deg, #128c7e 0%, #0d6e5a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* ===== Instructional Text ===== */
.instructional-text {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    margin: 20px 0;
}

/* ===== Loading Animation ===== */
.loading-indicator {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    flex-direction: column;
}

.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 30px 20px;
    margin: 15px auto;
    position: relative;
}

.loading-dots::before {
    content: "Chargement";
    position: absolute;
    bottom: 5px;
    font-size: 14px;
    color: #6c757d;
    opacity: 0.8;
    font-weight: 500;
}

.loading-dots .dot {
    width: 15px;
    height: 15px;
    background-color: #667eea;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots .dot:nth-child(3) {
    background-color: #007cba;
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0); 
        opacity: 0.6;
    }
    40% { 
        transform: scale(1); 
        opacity: 1;
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* ===== Pharmacies Grid ===== */
.pharmacies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

/* ===== Pharmacy Card ===== */
.pharmacy-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.pharmacy-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #007cba);
    border-radius: 12px 12px 0 0;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.pharmacy-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pharmacy-card:hover::before {
    opacity: 1;
}

.pharmacy-header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.pharmacy-title-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.pharmacy-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #20c997 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.pharmacy-card:hover .pharmacy-icon {
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
}

.pharmacy-name {
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.pharmacy-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pharmacy-info {
    margin-bottom: 20px;
}

.pharmacy-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.pharmacy-info-item:hover {
    background-color: #f8f9fa;
    margin: 0 -12px;
    padding: 12px;
    border-radius: 8px;
}

.info-icon {
    width: 32px;
    height: 32px;
    background-color: #e7f5ff;
    color: #1c7ed6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.info-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
}

.status-item .info-icon {
    background-color: #d4edda;
    color: #155724;
}

.status-badge {
    color: #667eea;
    font-weight: 600;
}

/* ===== Pharmacy Results Header ===== */
.pharmacy-results-header {
    background: linear-gradient(135deg, #ffd966 0%, #ffbb33 100%);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #f0ead6;
}

.pharmacy-results-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
}

/* ===== NEWLY ADDED: Pharmacy Filter Section ===== */
.pharmacy-filter-section h3 {
    /* HIGHLIGHT: NEW STYLE - Center text alignment */
    text-align: center;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    letter-spacing: 0.5px;
}

/* ===== NEWLY ADDED: Neighborhood Filter Dropdown ===== */
#neighborhood-filter {
    /* HIGHLIGHT: NEW STYLE - Increased padding from default */
    padding: 6px 16px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #2c3e50;
    background-color: #ffffff;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

#neighborhood-filter:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

#neighborhood-filter:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.data-source-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 1.1em;
}

.primary-source {
    color: #1976d2;
}

.smart-filter-info {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .pharmacy-header-section {
        padding: 1rem 0.5rem;
        border-radius: 16px;
        min-height: 160px;
        margin-bottom: 2rem;
    }
    
    .pharmacy-arabic-title {
        font-size: 2.2rem;
        letter-spacing: 1.5px;
    }
    
    .pharmacy-arabic-subtitle {
        font-size: 1.15rem;
    }
    
    .pharmacies-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
    
    .pharmacy-card {
        padding: 18px;
        border-radius: 12px;
    }
    
    .pharmacy-name {
        font-size: 1.1rem;
    }
    
    .welcome-message {
        padding: 20px 15px;
        margin: 0 0 15px 0;
        min-height: 100px;
    }
    
    .welcome-title {
        font-size: 1.5em;
    }
    
    .welcome-description {
        font-size: 1em;
    }
    
    .pharmacy-actions {
        flex-direction: column;
    }
    
    .btn-map,
    .btn-whatsapp {
        width: 100%;
    }
    
    .loading-dots {
        gap: 8px;
        padding: 25px 15px;
    }
    
    .loading-dots .dot {
        width: 12px;
        height: 12px;
    }
    
    .loading-dots::before {
        font-size: 12px;
    }
    
    .smart-filter-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    /* Table mobile styles */
    .pharmacy-pages-table-container {
        padding: 1.5rem 1rem;
        margin: 1.5rem 0;
        border-radius: 12px;
        overflow-x: auto;
    }
    
    .pharmacy-pages-header {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .pharmacy-pages-table {
        min-width: 600px;
    }
    
    .pharmacy-pages-table th,
    .pharmacy-pages-table td {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    
    .pharmacy-pages-table th {
        font-size: 0.8rem;
        letter-spacing: 0.3px;
    }
    
    .pharmacy-pages-table td:first-child,
    .pharmacy-pages-table td:nth-child(2) {
        white-space: normal;
        min-width: 120px;
    }
    
    .view-pharmacies-btn {
        padding: 0.8rem 0rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    /* NEW: Pharmacy finder container mobile adjustments */
    #pharmacy-finder-container {
        margin: -3px -1px !important;
    }
}

@media (max-width: 480px) {
    .pharmacy-header-section {
        padding: 2rem 1.5rem;
        margin-bottom: 1.5rem;
        min-height: 140px;
        border-radius: 14px;
    }
    
    .pharmacy-arabic-title {
        font-size: 1.9rem;
        letter-spacing: 1px;
    }
    
    .pharmacy-arabic-subtitle {
        font-size: 1rem;
    }
    
    .pharmacies-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 10px;
    }
    
    .pharmacy-card {
        margin-bottom: 15px;
        border-radius: 8px;
        padding: 15px;
    }
    
    .pharmacy-name {
        font-size: 1rem;
    }
    
    /* Table small mobile styles */
    .pharmacy-pages-table-container {
        padding: 1rem 0.8rem;
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .pharmacy-pages-header {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }
    
    .pharmacy-pages-table {
        font-size: 0.8rem;
    }
    
    .pharmacy-pages-table th,
    .pharmacy-pages-table td {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .pharmacy-pages-table th {
        font-size: 0.75rem;
        letter-spacing: 0.2px;
    }
    
    .view-pharmacies-btn {
        padding: 0.8rem 0rem;
        font-size: 0.75rem;
        border-radius: 6px;
    }
    
    /* HIGHLIGHT: Pharmacy finder container mobile adjustments for small screens */
    #pharmacy-finder-container {
        margin: -3px -1px !important;
    }
}

/* Card layout for very small screens */
@media (max-width: 640px) {
    .pharmacy-pages-table-container {
        /* HIGHLIGHT: prevent horizontal scroll on card layout */
        overflow-x: hidden; /* NEW */
    }

    .pharmacy-pages-table {
        /* HIGHLIGHT: override wider min-width from tablet styles */
        width: 100% !important; /* NEW */
        min-width: 0 !important; /* NEW */
    }
    .pharmacy-pages-table,
    .pharmacy-pages-table thead,
    .pharmacy-pages-table tbody,
    .pharmacy-pages-table th,
    .pharmacy-pages-table td,
    .pharmacy-pages-table tr {
        display: block;
    }
    
    .pharmacy-pages-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .pharmacy-pages-table tr {
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 10px 3.8px;
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        /* HIGHLIGHT: ensure each card fits available width */
        width: 100%; /* NEW */
        max-width: 100%; /* NEW */
        box-sizing: border-box; /* NEW */
    }
    
    .pharmacy-pages-table td {
        border: none;
        position: relative;
        padding: 0.8rem 0;
        text-align: left;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        /* HIGHLIGHT: avoid content overflow inside cards */
        width: 100%; /* NEW */
        max-width: 100%; /* NEW */
        box-sizing: border-box; /* NEW */
        white-space: normal; /* NEW - allow wrapping */
        overflow-wrap: anywhere; /* NEW */
        word-break: break-word; /* NEW */
    }
    
    .pharmacy-pages-table td:last-child {
        border-bottom: none;
        padding-top: 1rem;
        padding-bottom: 0;
    }
    
    .pharmacy-pages-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #1e3d72;
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
        display: block;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .pharmacy-pages-table td:nth-child(3) {
        text-align: left;
    }
    
    .pharmacy-pages-table td:nth-child(3):before {
        color: #28a745;
    }
    
    .view-pharmacies-btn {
        width: 100%;
        text-align: center;
        margin-top: 0.8rem;
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    /* HIGHLIGHT: Pharmacy finder container adjustments for very small screens */
    #pharmacy-finder-container {
        margin: -3px -1px !important;
    }
}

.choices__inner {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.1em;
    color: #333;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Override padding on mobile devices */
@media (max-width: 767px) {
    #left-area ul,
    .entry-content ul,
    .et-l--body ul,
    .et-l--footer ul,
    .et-l--header ul {
        padding: 0; /* removes all padding on mobile */
    }
    
    /* HIGHLIGHT: Pharmacy finder container mobile adjustments */
    #pharmacy-finder-container {
        margin: -3px -1px !important;
    }
}

/* Apply styles only for mobile screens (up to 767px wide) */
@media only screen and (max-width: 767px) {
    #left-area ul,
    .entry-content ul,
    .et-l--body ul,
    .et-l--footer ul,
    .et-l--header ul {
        list-style-type: disc; /* Adds bullet points */
        padding: 20px 0px 0px 0em; /* Adjusts spacing around list */
        line-height: 26px; /* Sets space between list items */
    }
}
