/* =====================================================
   LACTATION DRUG INDEX STYLES
   Uses Global Theme Variables
   ===================================================== */

/* 
   Note: This file relies on global-theme.css being loaded first.
   It uses semantic variables from the global theme.
*/

/* Developer Credit */
.developer-credit {
    font-size: 0.95rem;
    opacity: 0.85;
    margin-top: -2rem;
    margin-bottom: 3rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.developer-credit a {
    color: white;
    text-decoration: none;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    margin-left: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition, all 0.3s ease);
}

.developer-credit a:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ── Hero Section ─────────────────────────────── */
.lactmed-hero {
    text-align: center;
    padding: 3rem 1.5rem 2.5rem;
    background: linear-gradient(135deg, var(--primary-600, #0f766e) 0%, var(--primary-800, #1e40af) 100%);
    border-radius: var(--radius-2xl, 1rem);
    margin-bottom: 2rem;
}

.lactmed-hero .hero-content {
    margin-bottom: 2rem;
}

.lactmed-hero .hero-content h1 {
    font-size: var(--text-4xl, 2.25rem);
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    margin: 0 0 0.75rem 0;
    line-height: 1.1;
}

.lactmed-hero .hero-content p {
    font-size: var(--text-lg, 1.125rem);
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Enhanced Search Box */
.search-container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
}


/* Search icon — absolutely positioned inside the input */
.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary, #94a3b8);
    pointer-events: none;
    font-size: 1rem;
    z-index: 2;
}


#search-input {
    width: 100%;
    padding: 1.25rem 3.5rem 1.25rem 3rem; /* 3rem left clears the search icon */
    border: 2px solid transparent;
    border-radius: 9999px;
    font-size: 1.1rem;

    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

#search-input::placeholder {
    color: var(--text-tertiary);
}

#search-input:focus {
    outline: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
    border-color: var(--primary-300);
}

.clear-search-btn {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.clear-search-btn:hover {
    color: var(--error);
    background-color: var(--error-bg);
    opacity: 1;
}

.clear-search-btn[hidden] {
    display: none;
}

/* Main Content */
main {
    max-width: 1280px;
    margin: 0 auto;
    /* Padding handled by utility classes */
    position: relative;
    z-index: 20;
    min-height: 400px;
}

#results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    padding-bottom: 3rem;
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    grid-column: 1 / -1;
    color: var(--text-secondary);
    animation: fadeIn 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--primary-100);
    border-left-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

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

/* Enhanced Drug Card */
.drug-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    height: 100%;
    border-left: 6px solid transparent;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out backwards;
}

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

/* Safety Borders */
.drug-card.safe-border { border-left-color: var(--success); }
.drug-card.caution-border { border-left-color: var(--warning); }
.drug-card.avoid-border { border-left-color: var(--error); }
.drug-card.neutral-border { border-left-color: var(--neutral-400); }

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

.drug-card:active {
    transform: scale(0.98);
}

.drug-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.drug-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.drug-summary-preview {
    font-size: 1rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: auto;
    line-height: 1.6;
}

/* Badges */
.card-badges {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.badge.has-levels {
    background-color: var(--secondary-100);
    color: var(--secondary-700);
}

.badge.has-alt {
    background-color: var(--primary-100);
    color: var(--primary-700);
}

/* Safety Badges */
.badge-safe {
    background-color: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-bg); /* Use bg color for subtle border */
}

.badge-caution {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-bg);
}

.badge-avoid {
    background-color: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-bg);
}

.badge-neutral {
    background-color: var(--neutral-100);
    color: var(--neutral-700);
    border: 1px solid var(--border-subtle);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
    align-items: center;
    justify-content: center;
}

.modal.show {
    opacity: 1;
    display: flex;
}

.modal-content {
    background-color: var(--bg-surface);
    width: 100%;
    max-width: 900px;
    height: 90vh;
    max-height: 800px;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border-subtle);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    z-index: 10;
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 800;
}

.close-modal {
    background: var(--secondary-100);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.close-modal:hover {
    background-color: var(--error-bg);
    color: var(--error);
    transform: rotate(90deg);
}

/* Verdict Banner */
.verdict-banner {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.verdict-banner.safe {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.verdict-banner.caution {
    background-color: var(--warning-bg);
    color: var(--warning-text);
}

.verdict-banner.avoid {
    background-color: var(--error-bg);
    color: var(--error-text);
}

.verdict-banner.neutral {
    background-color: var(--neutral-100);
    color: var(--neutral-700);
}

.verdict-banner h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.verdict-banner p {
    font-size: 1rem;
    opacity: 0.95;
    line-height: 1.5;
}

/* e-lactancia Info Box */
.elactancia-info {
    margin-top: 1.25rem;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    background-color: var(--bg-surface);
}

.elactancia-info.safe {
    border: 2px solid var(--success);
    color: var(--success-text);
}

.elactancia-info.caution {
    border: 2px solid var(--warning);
    color: var(--warning-text);
}

.elactancia-info.avoid {
    border: 2px solid var(--error);
    color: var(--error-text);
}

.elactancia-info.neutral {
    border: 2px solid var(--neutral-400);
    color: var(--text-secondary);
}

/* Tabs */
.tabs {
    display: flex;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    background: var(--bg-surface);
    gap: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary-600);
}

.tab-btn.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

/* Highlighted Keywords */
.highlight-safe {
    background-color: var(--success-bg);
    color: var(--success-text);
    padding: 0 0.25rem;
    border-radius: 4px;
    font-weight: 600;
}

.highlight-caution {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    padding: 0 0.25rem;
    border-radius: 4px;
    font-weight: 600;
}

.highlight-avoid {
    background-color: var(--error-bg);
    color: var(--error-text);
    padding: 0 0.25rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Modal Body */
.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex-grow: 1;
    background-color: var(--bg-surface);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

.content-section p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.75;
}

/* Reference List */
.reference-list {
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.reference-list li {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    padding-left: 0.5rem;
}

.reference-list li::marker {
    color: var(--primary-600);
    font-weight: bold;
}

/* e-lactancia specific content area */
.elactancia-content {
    background-color: var(--bg-page);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    margin-bottom: 1.5rem;
}

.elactancia-content p {
    color: var(--text-secondary);
}

/* Dark Mode Overrides for specific elements that might need it */
[data-theme="dark"] .badge.has-levels {
    background-color: var(--secondary-800);
    color: var(--secondary-200);
}

[data-theme="dark"] .badge.has-alt {
    background-color: rgba(67, 56, 202, 0.2);
    color: var(--primary-300);
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Keep left clearance for the absolutely-positioned search icon */
    #search-input { padding: 1rem 2.5rem 1rem 3rem; }

    #results-container { grid-template-columns: 1fr; }
    
    .modal-content {
        height: 100%;
        max-height: none;
        width: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header { padding: 1rem 1.5rem; }
    .tabs { padding: 0 1rem; gap: 1rem; }
    .modal-body { padding: 1.5rem; }
}