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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e8ba3 100%);
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Animated Header */
.animated-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(45deg, #4682B4, #FF4500, #FFD700, #4682B4);
    background-size: 300% 300%;
    animation: gradientShift 8s ease infinite;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-header h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.refresh-btn {
    background: linear-gradient(135deg, #FFD700, #FF4500);
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: buttonGlow 2s ease-in-out infinite;
}

@keyframes buttonGlow {
    0%, 100% { box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 5px 25px rgba(255, 69, 0, 0.6); }
}

.refresh-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 69, 0, 0.5);
}

.refresh-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Filter Tags */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(70, 130, 180, 0.3);
    border-radius: 10px;
}

.tag {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid #4682B4;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
}

.tag:hover {
    background: rgba(255, 215, 0, 0.4);
    border-color: #FFD700;
    transform: translateY(-2px);
}

.tag.active {
    background: linear-gradient(135deg, #FF4500, #FFD700);
    border-color: #FF4500;
    animation: tagPulse 1.5s ease-in-out infinite;
}

@keyframes tagPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 69, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.loading.active {
    display: block;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top: 6px solid #FFD700;
    border-right: 6px solid #FF4500;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Innovations Grid */
.innovations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.innovation-card {
    background: linear-gradient(135deg, rgba(70, 130, 180, 0.4), rgba(126, 139, 163, 0.4));
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.4s ease;
    animation: cardFadeIn 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

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

.innovation-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
    transition: left 0.5s ease;
}

.innovation-card:hover::before {
    left: 100%;
}

.innovation-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(255, 69, 0, 0.4);
    border-color: #FF4500;
}

.innovation-category {
    display: inline-block;
    padding: 5px 15px;
    background: linear-gradient(135deg, #FF4500, #FFD700);
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 15px;
    text-transform: uppercase;
    animation: categoryShine 3s ease-in-out infinite;
}

@keyframes categoryShine {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

.innovation-card h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.innovation-card p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #fff;
}

.innovation-date {
    font-size: 0.85rem;
    color: #4682B4;
    margin-bottom: 15px;
    font-weight: 600;
}

.innovation-link {
    display: inline-block;
    padding: 10px 25px;
    background: linear-gradient(135deg, #4682B4, #FF4500);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    transition: all 0.3s ease;
    animation: linkPulse 2s ease-in-out infinite;
}

@keyframes linkPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(70, 130, 180, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 69, 0, 0.7); }
}

.innovation-link:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #FF4500, #FFD700);
}

/* AI Badge */
.ai-badge {
    display: inline-block;
    margin: 10px auto 15px;
    padding: 6px 18px;
    background: linear-gradient(135deg, #9b59b6, #3498db);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.6);
    animation: aiBadgeGlow 2s ease-in-out infinite;
}

@keyframes aiBadgeGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(155, 89, 182, 0.5); }
    50% { box-shadow: 0 0 25px rgba(52, 152, 219, 0.9); }
}

/* API Settings Panel */
.api-settings {
    margin-bottom: 20px;
    text-align: center;
}

.settings-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.5);
    color: #fff;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.settings-toggle:hover,
.settings-toggle-open {
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.settings-panel {
    margin-top: 15px;
    padding: 20px 25px;
    background: rgba(30, 60, 114, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    text-align: left;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.settings-description {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
}

.settings-link {
    color: #FFD700;
    text-decoration: underline;
}

.settings-link:hover {
    color: #FF4500;
}

.api-key-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.api-key-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid rgba(70, 130, 180, 0.6);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.api-key-input:focus {
    border-color: #FFD700;
}

.toggle-key-btn,
.save-key-btn,
.clear-key-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.toggle-key-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.toggle-key-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.save-key-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
}

.save-key-btn:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    transform: translateY(-2px);
}

.clear-key-btn {
    background: rgba(255, 69, 0, 0.3);
    color: #fff;
    border: 1px solid #FF4500;
}

.clear-key-btn:hover {
    background: rgba(255, 69, 0, 0.5);
    transform: translateY(-2px);
}

.api-key-status {
    margin-top: 10px;
    font-size: 0.85rem;
    min-height: 1.2em;
}

.status-ok { color: #2ecc71; }
.status-warn { color: #FFD700; }

@media (max-width: 600px) {
    .api-key-row {
        flex-direction: column;
    }
    .api-key-input {
        width: 100%;
    }
}


.error-message {
    text-align: center;
    padding: 40px;
    background: rgba(255, 69, 0, 0.3);
    border: 2px solid #FF4500;
    border-radius: 10px;
    margin: 20px 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    background: rgba(0, 0, 0, 0.3);
    margin-top: 40px;
}

footer p {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .animated-header h1 {
        font-size: 2.5rem;
    }
    
    .innovations-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-tags {
        justify-content: flex-start;
    }
}

/* Additional Animations */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.innovation-card:nth-child(even) {
    animation: cardFadeIn 0.6s ease-out, float 4s ease-in-out infinite;
}

.innovation-card:nth-child(odd) {
    animation: cardFadeIn 0.6s ease-out, float 4s ease-in-out infinite 2s;
}
