/* NDC Lookup Styles */

.ndc-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
}

/* Search Panel */
.search-panel {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.search-panel h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

/* Search Tabs */
.search-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search Inputs */
.search-group {
    margin-bottom: 20px;
}

.search-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.search-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.search-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* NDC Input Segments */
.ndc-input-wrapper {
    margin-bottom: 12px;
}

.ndc-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ndc-segment {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    font-family: 'Courier New', monospace;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.ndc-segment:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.separator {
    font-weight: bold;
    color: var(--text-secondary);
}

.format-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

#ndcFullInput {
    margin-top: 8px;
}

/* Search Options */
.search-options {
    margin-top: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Search Buttons */
.search-button,
.clear-button {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.search-button {
    background: var(--accent-primary);
    color: white;
    margin-bottom: 12px;
}

.search-button:hover {
    filter: brightness(0.85);
}

.clear-button {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.clear-button:hover {
    background: var(--bg-tertiary);
}

/* Results Panel */
.results-panel {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 600px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.results-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.result-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-primary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No Results & Initial State */
.no-results,
.initial-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.no-results svg,
.initial-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results p,
.initial-state p {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.no-results-hint,
.initial-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Results Container */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Result Card */
.result-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
}

.result-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--accent-primary);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.result-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0;
}

.ndc-badge {
    background: var(--accent-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Result Details */
.result-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
    font-size: 14px;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text-primary);
}

.ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ingredient-item {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 13px;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.view-details-btn {
    padding: 8px 16px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.view-details-btn:hover {
    filter: brightness(0.85);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.page-btn {
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Drug Details Modal */
.drug-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.drug-modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-section {
    margin-bottom: 24px;
}

.modal-section h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.modal-detail-item {
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.6;
}

.modal-detail-item strong {
    color: var(--text-secondary);
    margin-right: 8px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

.copy-btn,
.close-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    background: var(--accent-primary);
    color: white;
}

.copy-btn:hover {
    filter: brightness(0.85);
}

.close-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.close-btn:hover {
    background: var(--bg-tertiary);
}

/* Reference Panel */
.reference-panel {
    grid-column: 1 / -1;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.reference-panel h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.reference-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.ref-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
}

.ref-item strong {
    color: var(--text-primary);
}

.ref-item span {
    color: var(--text-secondary);
}

.ref-note {
    grid-column: 1 / -1;
    padding: 12px;
    background: rgba(245, 158, 11, 0.15);
    border-left: 4px solid var(--warning);
    border-radius: 4px;
    font-size: 13px;
}

/* Copy Notification */
.copy-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 2000;
}

.copy-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .ndc-content {
        grid-template-columns: 1fr;
    }
    
    .search-panel {
        position: static;
    }
    
    .reference-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .ndc-content {
        padding: 12px;
    }
    
    .search-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
    }
    
    .detail-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .result-header {
        flex-direction: column;
        gap: 8px;
        align-items: start;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}