* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.search-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.media-type-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: #f8f9fa;
    border: 2px solid transparent;
}

.radio-option:hover {
    background: #e9ecef;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.2s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: #667eea;
    background: #667eea;
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.radio-option input[type="radio"]:checked ~ .radio-label {
    color: #667eea;
    font-weight: 600;
}

.radio-label {
    font-weight: 500;
    transition: all 0.2s ease;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-note {
    margin-bottom: 2rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #6c757d;
}

.search-note code {
    background: #e9ecef;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.book-search-note {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    color: #0c5460;
}

.book-search-note code {
    background: #d1ecf1;
    color: #0c5460;
}

#searchInput {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    background: white;
}

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

#searchButton {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

#searchButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

#searchButton:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner.hidden {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.trigger-warning-section h3 {
    margin-bottom: 1rem;
    color: #495057;
    font-weight: 600;
}

.trigger-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trigger-tag {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #6c757d;
    transition: all 0.2s ease;
    cursor: pointer;
}

.trigger-tag.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.trigger-tag:hover {
    background: #e9ecef;
}

.trigger-tag.active:hover {
    background: #5a6fd8;
}

.results-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.result-card {
    animation: slideIn 0.3s ease-out;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.result-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
}

.safety-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.safety-status.safe {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.safety-status.not-recommended {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.result-info {
    margin-bottom: 1.5rem;
}

.result-info p {
    margin-bottom: 0.5rem;
    color: #6c757d;
}

.result-info strong {
    color: #495057;
}

.analysis-toggle {
    margin: 1rem 0;
    text-align: center;
}

.toggle-button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
}

.toggle-button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.toggle-icon {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
}

.toggle-button.expanded .toggle-icon {
    transform: rotate(180deg);
}

.analysis-details {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.analysis-details.hidden {
    display: none !important;
}

.analysis-details h4 {
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 600;
}

.analysis-details p {
    color: #6c757d;
    margin: 0;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin-bottom: 2rem;
}

.hidden {
    display: none !important;
}

/* API Debug Section */
.api-debug-section {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    border: 2px solid #e9ecef;
}

.api-debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.api-debug-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.api-debug-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #667eea;
}

.api-debug-info {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #495057;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.api-debug-info h4 {
    color: #667eea;
    margin: 0.5rem 0 0.25rem 0;
    font-size: 0.95rem;
}

.api-debug-info .api-result {
    background: white;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.api-debug-info .api-success {
    border-left: 4px solid #28a745;
}

.api-debug-info .api-error {
    border-left: 4px solid #dc3545;
}

.api-debug-info .api-no-results {
    border-left: 4px solid #ffc107;
}

footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .search-section {
        padding: 1.5rem;
    }
    
    .media-type-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Source Details Styling */
.source-details {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6c757d;
}

.source-details p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #495057;
}

.source-details p:first-child {
    margin-top: 0;
}

.source-details p:last-child {
    margin-bottom: 0;
}

.source-details strong {
    color: #212529;
    font-weight: 600;
}

/* Information Section Styling */
.info-section {
    margin-top: 3rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

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

.info-section h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.info-details {
    margin-top: 1rem;
}

.info-details.hidden {
    display: none;
}

.info-description {
    color: #5a6c7d;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.source-category {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.source-category h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.source-category ul {
    list-style: none;
    padding: 0;
}

.source-category li {
    margin-bottom: 0.75rem;
    padding-left: 1rem;
    position: relative;
    color: #5a6c7d;
    line-height: 1.5;
}

.source-category li:before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.source-category strong {
    color: #2c3e50;
    font-weight: 600;
}

.confidence-info {
    background: #e8f4fd;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #17a2b8;
    margin-bottom: 2rem;
}

.confidence-info h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.confidence-info p {
    color: #5a6c7d;
    line-height: 1.6;
    margin: 0;
}

.disclaimer {
    background: #fff3cd;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #ffc107;
}

.disclaimer p {
    color: #856404;
    line-height: 1.6;
    margin: 0;
}

.disclaimer strong {
    color: #856404;
    font-weight: 600;
}

/* Responsive design for info section */
@media (max-width: 768px) {
    .info-section {
        margin-top: 2rem;
        padding: 1.5rem;
    }
    
    .sources-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .source-category {
        padding: 1rem;
    }
    
    .confidence-info,
    .disclaimer {
        padding: 1rem;
    }
}

/* Feedback Section Styling */
.feedback-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    text-align: center;
}

.feedback-section h3 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.feedback-description {
    color: #5a6c7d;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.5;
}

.feedback-actions {
    margin-bottom: 1rem;
}

.feedback-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
}

.feedback-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.feedback-button:active {
    transform: translateY(0);
}

.feedback-icon {
    font-size: 1.2rem;
}

.feedback-text {
    font-weight: 600;
}

.feedback-note {
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    font-style: italic;
}

.feedback-note strong {
    color: #495057;
    font-weight: 600;
}

/* Responsive design for feedback section */
@media (max-width: 768px) {
    .feedback-section {
        margin-top: 1rem;
        padding: 1rem;
    }
    
    .feedback-button {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .feedback-description {
        font-size: 0.95rem;
    }
    
    .feedback-section h3 {
        font-size: 1.1rem;
    }
}
