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

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --success-color: #10b981;
    --error-color: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-color) 0%, #1e1b4b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.search-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.quick-dates-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

.quick-dates-label {
    display: block;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1rem;
}

.quick-dates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.quick-dates-grid::-webkit-scrollbar {
    width: 8px;
}

.quick-dates-grid::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.quick-dates-grid::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.quick-date-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 0.85rem;
    min-height: auto;
}

.quick-date-btn:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--bg-color) 0%, rgba(99, 102, 241, 0.1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.quick-date-btn:active {
    transform: translateY(0);
}

.quick-date-date {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
    font-size: 0.85rem;
}

.quick-date-event {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
}

.date-input-group {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.date-input-group > *:not(label):not(.format-hint) {
    flex-shrink: 0;
}

.date-input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    width: 100%;
}

.date-input-group input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.format-hint {
    display: block;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.8;
    font-style: italic;
}

.date-input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.date-input-group input[type="text"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.search-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.search-btn:active {
    transform: translateY(0);
}

.api-keys-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.api-keys-section details {
    color: var(--text-secondary);
}

.api-keys-section summary {
    cursor: pointer;
    padding: 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.api-keys-section summary:hover {
    background: rgba(99, 102, 241, 0.1);
}

.api-keys {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.api-key-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.api-key-input label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.api-key-input input {
    padding: 10px 14px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.api-key-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.loading {
    text-align: center;
    padding: 40px;
    background: var(--card-bg);
    border-radius: 16px;
    margin-bottom: 30px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.results {
    animation: fadeIn 0.5s ease;
}

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

.date-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.date-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.result-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.result-card h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.content {
    max-height: 500px;
    overflow-y: auto;
}

.content::-webkit-scrollbar {
    width: 8px;
}

.content::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.event-item, .birthday-item, .headline-item, .fun-fact-item {
    padding: 15px;
    margin-bottom: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s ease;
}

.event-item:hover, .birthday-item:hover, .headline-item:hover, .fun-fact-item:hover {
    border-left-color: var(--accent-color);
    transform: translateX(5px);
}

.fun-fact-item {
    border-left-color: var(--secondary-color);
    font-style: italic;
    background: linear-gradient(135deg, var(--bg-color) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.event-item h4, .birthday-item h4, .headline-item h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.event-item p, .birthday-item p, .headline-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.search-more-link {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.search-more-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.event-year {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 10px;
}

.event-year.selected-year {
    background: var(--success-color);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.selected-year-event {
    border-left-color: var(--success-color);
    background: linear-gradient(135deg, var(--bg-color) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-style: italic;
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--error-color);
    color: var(--error-color);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.hidden {
    display: none;
}

footer {
    margin-top: 60px;
    padding: 40px 20px;
    background: var(--card-bg);
    border-top: 2px solid var(--border-color);
    border-radius: 16px 16px 0 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.footer-section:last-of-type {
    border-bottom: none;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-section p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
    margin: 0;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section li {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 2;
    padding-left: 20px;
    position: relative;
}

.footer-section li:before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.footer-section li strong {
    color: var(--text-primary);
}

.footer-brand {
    text-align: center;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
    margin-top: 30px;
}

.footer-brand p {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.footer-brand strong {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 768px) {
    .footer-section {
        margin-bottom: 30px;
        padding-bottom: 20px;
    }

    .footer-section h3 {
        font-size: 1.1rem;
    }

    .footer-section p,
    .footer-section li {
        font-size: 0.9rem;
    }

    .footer-brand p {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .date-input-group {
        flex-direction: column;
    }

    .date-input-group input[type="date"],
    .search-btn {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .quick-dates-grid {
        grid-template-columns: 1fr;
        max-height: 300px;
        gap: 6px;
    }

    .quick-date-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .quick-date-date {
        font-size: 0.8rem;
        margin-bottom: 2px;
    }

    .quick-date-event {
        font-size: 0.75rem;
    }
}

