/* Modern CSS for Animal Explorer - Enhanced UX */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Smooth scrolling and improved animations */
html {
    scroll-behavior: smooth;
}

/* Loading animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes progressFlow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.65;
    color: #2c3e50;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 12s ease infinite;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    position: relative;
}

/* Animated background gradient */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating particles animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.3), transparent),
                      radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.2), transparent),
                      radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.4), transparent),
                      radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.3), transparent),
                      radial-gradient(2px 2px at 160px 30px, rgba(255,255,255,0.2), transparent);
    background-repeat: repeat;
    background-size: 250px 250px;
    animation: particleFloat 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes particleFloat {
    0% { transform: translate(0, 100vh) rotate(0deg); }
    100% { transform: translate(0, -250px) rotate(360deg); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(15px, 3vw, 25px);
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: clamp(2.2em, 4vw, 2.8em);
    margin-bottom: 15px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

header p {
    font-size: clamp(1.1em, 2.5vw, 1.3em);
    opacity: 0.95;
    font-weight: 300;
    letter-spacing: 0.3px;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

main {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(150%);
    border-radius: 24px;
    padding: clamp(30px, 5vw, 50px);
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.37),
        0 4px 16px rgba(31, 38, 135, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    margin-bottom: 30px;
    animation: fadeInUp 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

main::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.8s;
}

main:hover::before {
    left: 100%;
}

main:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

/* Rate Limiting Styles */
.rate-limit-section {
    margin-bottom: 30px;
}

.rate-limit-card {
    background: linear-gradient(145deg, #ffebeb, #ffe0e0);
    border: 2px solid #ff6b6b;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

.rate-limit-card h2 {
    color: #d63031;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.rate-limit-message {
    font-size: 1.2em;
    color: #d63031;
    font-weight: 600;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
}

.rate-limit-info {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.rate-limit-info ul {
    margin-left: 20px;
    margin-top: 10px;
}

.rate-limit-info li {
    margin: 8px 0;
    font-size: 1.1em;
}

.rate-limit-countdown {
    background: #fff;
    border: 2px solid #ff6b6b;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    font-size: 1.3em;
    font-weight: bold;
    color: #d63031;
}

.rate-limit-countdown.expired {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

/* Form Styles with enhanced animations */
.search-container {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.search-form {
    width: 100%;
    max-width: 600px; /* Max width for the form */
    text-align: center; /* Center align the label */
    margin-bottom: 40px;
    position: relative;
}

.search-form::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 1px;
    animation: expandLine 2s ease-out infinite alternate;
}

@keyframes expandLine {
    0% { width: 60px; opacity: 0.5; }
    100% { width: 120px; opacity: 1; }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* margin: 0 auto; /* No longer needed here */
    text-align: center;
}

.input-group label {
    font-size: 1.2em;
    font-weight: 600;
    color: #555;
    transition: color 0.2s ease;
    text-align: center;
}

.input-group input {
    padding: 18px 24px;
    font-size: 1.1em;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    font-family: inherit;
    letter-spacing: 0.5px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.input-group input::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.6s;
}

.input-group input:hover::before {
    left: 100%;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.2),
        0 20px 40px rgba(102, 126, 234, 0.15),
        0 8px 25px rgba(102, 126, 234, 0.1);
    transform: translateY(-4px) scale(1.02);
}

.input-group input::placeholder {
    color: #aaa;
    transition: opacity 0.3s ease;
}

.input-group input:focus::placeholder {
    opacity: 0.7;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(-1px);
    transition: all 0.1s ease;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 2px 10px rgba(108, 117, 125, 0.2);
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

/* Button ripple effect */
.btn-primary:before, .btn-secondary:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.6s, height 0.6s;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.btn-primary:active:before, .btn-secondary:active:before {
    width: 300px;
    height: 300px;
}

.btn-primary *, .btn-secondary * {
    position: relative;
    z-index: 1;
}

/* Examples with staggered animations */
.examples {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.examples::before {
    content: '✨';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5em;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(0.8); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.2); }
}

.examples h3 {
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.example-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.tag {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 2px solid rgba(102, 126, 234, 0.1);
    padding: 12px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-weight: 500;
    font-size: 0.95em;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    animation: tagFloat 3s ease-in-out infinite;
    animation-delay: calc(var(--tag-index, 0) * 0.2s);
}

@keyframes tagFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.tag:nth-child(1) { --tag-index: 0; }
.tag:nth-child(2) { --tag-index: 1; }
.tag:nth-child(3) { --tag-index: 2; }
.tag:nth-child(4) { --tag-index: 3; }
.tag:nth-child(5) { --tag-index: 4; }
.tag:nth-child(6) { --tag-index: 5; }
.tag:nth-child(7) { --tag-index: 6; }
.tag:nth-child(8) { --tag-index: 7; }

.tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
    transition: left 0.6s;
}

.tag:hover::before {
    left: 100%;
}

.tag:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    transform: translateY(-8px) scale(1.1);
    box-shadow: 
        0 20px 40px rgba(102, 126, 234, 0.4),
        0 8px 20px rgba(102, 126, 234, 0.3);
    animation: none;
}

.tag:active {
    transform: translateY(0) scale(1.02);
    transition: all 0.1s ease;
}

/* Features */
.features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.feature {
    text-align: center;
    padding: 35px 30px;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.8));
    backdrop-filter: blur(10px);
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-basis: 300px;
    flex-grow: 1;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.feature:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

@keyframes featureFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

.feature:nth-child(1) { --feature-index: 0; }
.feature:nth-child(2) { --feature-index: 1; }
.feature:nth-child(3) { --feature-index: 2; }

.feature::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: featureRotate 4s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.feature:hover::before {
    opacity: 1;
}

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

.feature:hover {
    transform: translateY(-15px) scale(1.05) rotate(-1deg);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.2),
        0 10px 25px rgba(102, 126, 234, 0.1);
    background: linear-gradient(145deg, rgba(255, 255, 255, 1), rgba(248, 250, 252, 0.9));
    animation: none;
}

.feature:hover .feature-icon {
    transform: scale(1.3) rotate(15deg);
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    animation: none;
}

.feature-icon {
    font-size: 3.5em;
    margin-bottom: 25px;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: block;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.15));
    animation: iconPulse 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

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

.feature-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.2), transparent);
    border-radius: 50%;
    z-index: -1;
    animation: iconGlow 3s ease-in-out infinite;
}

@keyframes iconGlow {
    0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.3; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

.feature h3 {
    margin-bottom: 12px;
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 600;
    letter-spacing: -0.2px;
    line-height: 1.3;
}

.feature p {
    color: #5a6c7d;
    font-size: 1em;
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Progress */
.progress-section {
    margin-bottom: 30px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.5s ease;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 1.1em;
    color: #666;
    font-weight: 500;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, transparent 63%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease-in-out infinite;
    border-radius: 8px;
}

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

.skeleton-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    display: none;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin: 0 auto 20px;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.skeleton-item {
    padding: 15px;
    background: #f0f0f0;
    border-radius: 8px;
    border-left: 4px solid #e0e0e0;
}

.skeleton-label {
    height: 12px;
    width: 40%;
    margin-bottom: 8px;
}

.skeleton-value {
    height: 16px;
    width: 80%;
}

.skeleton-image {
    height: 300px;
    width: 100%;
    margin: 0 auto;
    border-radius: 10px;
}

/* Show skeleton when loading */
.loading .skeleton-card {
    display: block;
}

.loading .results {
    display: none !important;
}

/* Results */
.results {
    margin-top: 30px;
}

.result-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}

.tab-btn {
    padding: 12px 25px;
    background: none;
    border: none;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-btn:hover {
    background: #f8f9fa;
}

.info-card, .image-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.info-card h2, .image-card h2 {
    margin-bottom: 25px;
    color: #2c3e50;
    text-align: center;
    font-size: 1.6em;
    font-weight: 600;
    letter-spacing: -0.4px;
    line-height: 1.3;
}

.animal-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.info-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.info-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.info-label {
    font-weight: 700;
    color: #2c3e50;
    font-size: 0.85em;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    color: #4a5568;
    font-size: 1.05em;
    line-height: 1.5;
    font-weight: 400;
}

.image-container {
    text-align: center;
    margin-bottom: 20px;
}

.generated-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

/* Suggestions styles */
.suggestions-container {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.suggestions-container h4 {
    color: #007bff;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.btn-suggestion {
    display: inline-block;
    margin: 5px;
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.btn-suggestion:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

/* Error styles */
.error-section {
    margin-top: 30px;
}

.error-card {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 10px;
    padding: 20px;
}

.error-card h2 {
    color: #721c24;
    margin-bottom: 15px;
}

.error-card ul {
    color: #721c24;
    margin-left: 20px;
}

/* Actions */
.actions {
    text-align: center;
    margin-top: 30px;
}

/* Footer */
.main-footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    margin-top: 20px;
    padding: 20px 0;
}

/* New Enhanced Elements Styles */

/* Header Stats */
.header-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.stat-number {
    display: block;
    font-size: 2em;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-label {
    display: block;
    font-size: 0.9em;
    opacity: 0.9;
    margin-top: 5px;
    font-weight: 300;
}

/* Enhanced Input Container */
.input-container {
    position: relative;
}

.input-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    background: linear-gradient(45deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.input-container:focus-within .input-highlight {
    opacity: 1;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

/* Enhanced Button */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-text {
    transition: opacity 0.3s ease;
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary.loading .btn-text {
    opacity: 0;
}

.btn-primary.loading .btn-loader {
    opacity: 1;
}

.loader-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

/* Enhanced Tags */
.tag-emoji {
    font-size: 1.2em;
    margin-right: 8px;
    transition: transform 0.3s ease;
}

.tag:hover .tag-emoji {
    transform: scale(1.3) rotate(10deg);
}

.shuffle-tags {
    margin-top: 20px;
    text-align: center;
}

.tag-shuffle {
    background: linear-gradient(145deg, #ff6b6b, #feca57) !important;
    color: white !important;
    border-color: #ff6b6b !important;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.tag-shuffle:hover {
    background: linear-gradient(135deg, #ff5252, #ffb300) !important;
    transform: translateY(-8px) scale(1.1);
    box-shadow: 0 20px 40px rgba(255, 107, 107, 0.4);
}

.tag-shuffle .tag-emoji {
    color: white;
}

/* Feature badges */
.feature-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 0.7em;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.feature:hover .feature-badge {
    opacity: 1;
    transform: scale(1);
}

/* Popular section */
.popular-section {
    margin: 40px 0;
    text-align: center;
}

.popular-section h3 {
    color: #2c3e50;
    font-size: 1.4em;
    margin-bottom: 25px;
    font-weight: 600;
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.popular-item {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 15px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.popular-item:hover {
    transform: translateY(-5px) scale(1.05);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* Enhanced Footer */
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.footer-main {
    text-align: center;
    flex-grow: 1;
}

.tech-stack {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.tech-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.tech-badge:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.feature {
    background: rgba(255, 255, 255, 0.5);
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) both;
    opacity: 1; /* Fix for hover-out fade flicker */
}

.footer-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.footer-link {
    color: white;
    text-decoration: none;
    font-size: 0.9em;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    opacity: 0.8;
}

.footer-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    text-decoration: none;
}

/* Enhanced JavaScript Elements */

/* Input shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.input-group input.shake {
    animation: shake 0.5s ease-in-out;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.2);
}

/* Enhanced input states */
.input-container.focused {
    z-index: 10;
}

.input-container.focused .input-highlight {
    opacity: 1;
    animation: inputGlow 2s ease-in-out infinite alternate;
}

@keyframes inputGlow {
    0% { box-shadow: 0 0 5px rgba(102, 126, 234, 0.3); }
    100% { box-shadow: 0 0 15px rgba(102, 126, 234, 0.6); }
}

/* Search suggestions */
.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 500;
}

.suggestion-item:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: translateX(5px);
}

.suggestion-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.suggestion-item:first-child {
    border-radius: 12px 12px 0 0;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.37),
        0 4px 16px rgba(31, 38, 135, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1000;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.notification-message {
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.4;
}

.notification-warning {
    border-left: 4px solid #feca57;
}

.notification-success {
    border-left: 4px solid #2ed573;
}

.notification-error {
    border-left: 4px solid #ff6b6b;
}

.notification-info {
    border-left: 4px solid #667eea;
}

/* Enhanced button states */
.btn-shuffle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: scale(0.95);
}

/* Loading input state */
.input-group input.loading {
    background: linear-gradient(145deg, #f8fafc, #e2e8f0);
    cursor: progress;
    opacity: 0.8;
}

/* Enhanced popular items */
.popular-item {
    animation: popIn 0.6s ease-out both;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Enhanced tag flip animation */
.tag {
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tag.flipping {
    transform: rotateY(90deg) scale(0.8);
}

/* Staggered entrance animations */
.feature {
    animation: slideInUp 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Enhanced stat items */
.stat-item {
    animation: bounceInDown 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}

@keyframes bounceInDown {
    0% {
        opacity: 0;
        transform: translateY(-60px) scale(0.3);
    }
    50% {
        opacity: 1;
        transform: translateY(0) scale(1.05);
    }
    70% {
        transform: translateY(-10px) scale(0.9);
    }
    80% {
        transform: translateY(0) scale(1.02);
    }
    90% {
        transform: translateY(-5px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    main {
        padding: 25px;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .input-group {
        align-items: stretch;
    }
    
    .result-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .tab-btn.active {
        border-left-color: #667eea;
        border-bottom-color: transparent;
    }
    
    /* Mobile adjustments for new elements */
    .header-stats {
        gap: 20px;
        flex-direction: column;
        align-items: center;
    }
    
    .stat-item {
        padding: 12px 20px;
        min-width: 120px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .tech-stack {
        gap: 8px;
    }
    
    .tech-badge {
        font-size: 0.75em;
        padding: 3px 10px;
    }
    
    .popular-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .example-tags {
        gap: 8px;
    }
    
    .tag {
        padding: 10px 16px;
        font-size: 0.85em;
    }
    
    /* Mobile notification adjustments */
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .search-suggestions {
        left: -10px;
        right: -10px;
        margin-left: 10px;
        margin-right: 10px;
    }
}

