/**
 * GIF Downloader - Modern Stylesheet
 * Mobile-First, Dark Mode Support, Bootstrap 5 Based
 */

/* ========================================
   CSS Variables & Theme
   ======================================== */
:root {
    --primary-color: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --white-color: #111827;
    --light-color: #1f2937;
    --dark-color: #f9fafb;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
}

/* ========================================
   Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--white-color);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   Header & Navigation
   ======================================== */
.header {
    background: var(--white-color);
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-speed);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
}

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

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: all var(--transition-speed);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color) !important;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: var(--primary-color);
}

.theme-toggle {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.theme-toggle:hover {
    background: var(--light-color);
    transform: rotate(180deg);
}

/* ========================================
   Hero Section
   ======================================== */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2" fill="white" opacity="0.1"/></svg>');
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(50px) translateY(50px); }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2.5rem;
}

/* ========================================
   Forms
   ======================================== */
.download-form,
.search-form {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
}

.input-group-text {
    border-color: var(--border-color);
}

.form-control {
    border-color: var(--border-color);
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    font-weight: 600;
    padding: 0.75rem 2rem;
    transition: all var(--transition-speed);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   Divider
   ======================================== */
.divider-or {
    position: relative;
    text-align: center;
    margin: 2rem 0;
}

.divider-or::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.divider-or span {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0 1rem;
    color: white;
    font-weight: 600;
}

/* ========================================
   Supported Platforms
   ======================================== */
.supported-platforms {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ========================================
   Quick Stats
   ======================================== */
.quick-stats {
    margin-top: 3rem;
}

.stat-item {
    text-align: center;
    color: white;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
}

/* ========================================
   Section Styles
   ======================================== */
.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

/* ========================================
   Categories
   ======================================== */
.category-card {
    display: block;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition-speed);
    color: var(--text-primary);
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    color: var(--primary-color);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.category-name {
    font-weight: 600;
    font-size: 1rem;
}

/* ========================================
   Trending Tags
   ======================================== */
.trending-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.trending-tag {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 2rem;
    color: var(--text-primary);
    font-weight: 500;
    transition: all var(--transition-speed);
}

.trending-tag:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* ========================================
   Feature Cards
   ======================================== */
.feature-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    transition: all var(--transition-speed);
    height: 100%;
}

.feature-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.5rem;
    color: white;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-description {
    color: var(--text-secondary);
    margin: 0;
}

/* ========================================
   Step Cards
   ======================================== */
.step-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    position: relative;
    transition: all var(--transition-speed);
}

.step-card:hover {
    box-shadow: var(--shadow-lg);
    transform: scale(1.03);
}

.step-number {
    position: absolute;
    top: -15px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.step-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.step-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.step-description {
    color: var(--text-secondary);
    margin: 0;
}

/* ========================================
   GIF Grid
   ======================================== */
.gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gif-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all var(--transition-speed);
    cursor: pointer;
}

.gif-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.gif-card-image {
    position: relative;
    overflow: hidden;
    background: var(--light-color);
    aspect-ratio: 1;
}

.gif-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gif-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.gif-card:hover .gif-card-overlay {
    opacity: 1;
}

.gif-card-body {
    padding: 1rem;
}

.gif-card-title {
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gif-card-source {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ========================================
   Skeleton Loader
   ======================================== */
.skeleton-loader {
    background: linear-gradient(90deg, var(--light-color) 25%, #e0e0e0 50%, var(--light-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 0.75rem;
    height: 300px;
}

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

/* ========================================
   Accordion (FAQ)
   ======================================== */
.accordion-item {
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.accordion-button {
    background: white;
    color: var(--text-primary);
    font-weight: 600;
    padding: 1.25rem;
}

.accordion-button:not(.collapsed) {
    background: var(--light-color);
    color: var(--primary-color);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: var(--primary-color);
}

.accordion-body {
    padding: 1.25rem;
    color: var(--text-secondary);
}

/* ========================================
   SEO Content
   ======================================== */
.seo-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
}

.seo-content h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.seo-content h3 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.seo-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.seo-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.seo-content li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: var(--dark-color);
}

.footer-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: white;
}

.footer-text {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    transition: all var(--transition-speed);
}

.footer-links a:hover {
    color: white;
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all var(--transition-speed);
}

.social-link:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.spinner-container {
    text-align: center;
    color: white;
}

/* ========================================
   Animations
   ======================================== */
.animate-fade-in {
    animation: fadeIn 0.8s ease-out;
}

.animate-fade-in-delay {
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.animate-slide-up {
    animation: slideUp 0.8s ease-out 0.4s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 991px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .gif-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 767px) {
    .hero-section {
        padding: 3rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .download-form,
    .search-form {
        padding: 1rem;
    }
    
    .input-group-lg .form-control {
        font-size: 0.95rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .gif-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .feature-card,
    .step-card {
        padding: 1.5rem;
    }
}

@media (max-width: 575px) {
    .category-card {
        padding: 1rem;
    }
    
    .category-icon {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.shadow-custom {
    box-shadow: var(--shadow-lg);
}

/* Mobile Stacking */
@media (max-width: 767px) {
    .input-group-lg {
        flex-direction: column;  /* Stack vertically */
    }
    
    .input-group-lg .btn {
        width: 100%;  /* Full width */
    }
}

/* Touch Friendly */
.btn {
    min-height: 44px;  /* Apple recommended */
    min-width: 44px;
}

/* No Auto-Zoom on iOS */
.form-control {
    font-size: 16px !important;
}