/* Custom styles for Ragnar - Enhanced UI/UX */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --dark-gradient: linear-gradient(135deg, #232526 0%, #414345 100%);
    --darker-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.4);
    --border-radius: 15px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Dark theme colors */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #8a8a8a;
    --border-color: #404040;
    --accent-purple: #bb86fc;
    --accent-teal: #03dac6;
}

/* Global styles */
* {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

/* Enhanced Navigation */
.navbar {
    background: var(--darker-gradient) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.navbar-brand {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(45deg, #fff, #f8f9fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: var(--transition);
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    position: relative;
    transition: var(--transition);
    border-radius: 8px;
    margin: 0 4px;
    padding: 8px 16px !important;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

/* Enhanced Hero Section */
.hero-section {
    background: var(--primary-gradient);
    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 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

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

.hero-title {
    font-weight: 900;
    background: linear-gradient(45deg, #fff, #f8f9fa, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out 0.2s both;
    font-weight: 300;
    opacity: 0.95;
}

.hero-button {
    animation: fadeInUp 0.8s ease-out 0.4s both;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    font-weight: 600;
    padding: 12px 30px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.hero-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.25);
}

.hero-button:hover::before {
    left: 100%;
}

/* Subreddit Selection */
.subreddit-selection {
    margin: 2rem 0;
}

.subreddit-selection h5 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.subreddit-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.subreddit-btn::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.5s;
}

.subreddit-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-teal);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.subreddit-btn:hover::before {
    left: 100%;
}

.subreddit-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.subreddit-btn.active:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Enhanced Meme Cards */
.meme-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.meme-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: var(--transition);
    z-index: 1;
}

.meme-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--card-shadow-hover);
}

.meme-card:hover::before {
    opacity: 1;
}

.card-img-top {
    height: 280px;
    object-fit: cover;
    transition: var(--transition);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.card-img-top[src*="data:image/svg"] {
    object-fit: contain;
    background: none;
}

.meme-card:hover .card-img-top {
    transform: scale(1.05);
}

.card-body {
    position: relative;
    z-index: 2;
    padding: 1.5rem;
}

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

.meme-number {
    background: var(--primary-gradient);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.view-full-btn {
    background: var(--primary-gradient);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    padding: 6px 12px;
    font-size: 0.8rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.view-full-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.3s;
}

.view-full-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.view-full-btn:hover::before {
    left: 100%;
}

/* Enhanced Loading States */
.loading-container {
    position: relative;
    padding: 3rem 0;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    border-color: #667eea;
    border-right-color: transparent;
    animation: spin 1s linear infinite, pulse 2s ease-in-out infinite alternate;
}

.loading-text {
    margin-top: 1.5rem;
    font-weight: 600;
    color: #667eea;
    animation: fadeInOut 2s ease-in-out infinite;
}

/* Enhanced Grid */
.memes-grid {
    gap: 1.5rem !important;
}

/* Force 3-column layout */
.meme-grid-item {
    flex: 0 0 calc(33.333% - 1rem);
    max-width: calc(33.333% - 1rem);
}

@media (max-width: 992px) {
    .meme-grid-item {
        flex: 0 0 calc(50% - 0.75rem);
        max-width: calc(50% - 0.75rem);
    }
}

@media (max-width: 576px) {
    .meme-grid-item {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Staggered Animation for Cards */
.meme-card {
    animation: slideInUp 0.6s ease-out both;
}

/* Progressive animation delays for better performance with 50 cards */
.meme-grid-item:nth-child(n) .meme-card { animation-delay: calc(0.02s * var(--animation-index, 1)); }

/* Enhanced Footer */
footer {
    background: var(--dark-gradient) !important;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

footer a {
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 6px;
}

footer a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Enhanced Error States */
.error-container {
    animation: shake 0.5s ease-in-out;
}

.alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    animation: slideInDown 0.5s ease-out;
}

.alert-danger {
    background: var(--secondary-gradient);
    color: white;
}

.alert-success {
    background: var(--success-gradient);
    color: white;
}

.alert-info {
    background: var(--primary-gradient);
    color: white;
}

/* Scroll Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

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

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

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

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

/* Responsive Improvements */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .meme-card {
        margin-bottom: 1.5rem;
    }
    
    .navbar-brand {
        font-size: 1.5rem;
    }
    
    .card-img-top {
        height: 200px;
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-button {
        padding: 10px 25px;
        font-size: 0.9rem;
    }
    
    .memes-grid {
        gap: 1rem !important;
    }
}

/* Dark mode support */
/* Container and page styling */
.container {
    max-width: 1400px;
}

/* Alert styling for dark theme */
.alert {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.alert-success {
    background: var(--success-gradient);
    border: none;
}

.alert-danger {
    background: var(--secondary-gradient);
    border: none;
}

.alert-info {
    background: var(--primary-gradient);
    border: none;
}

/* WhatsApp Subscription Section */
.subscription-section {
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.subscription-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1) 0%, rgba(37, 211, 102, 0.05) 100%);
    z-index: 1;
}

.subscription-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    position: relative;
    z-index: 2;
    transition: var(--transition);
}

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

.whatsapp-icon {
    font-size: 4rem;
    color: #25d366;
    text-shadow: 0 0 20px rgba(37, 211, 102, 0.5);
    animation: pulse 2s infinite;
}

.subscription-title {
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subscription-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.7;
}

.subscription-features {
    margin: 2rem 0;
}

.feature-item {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--darker-gradient);
    border-radius: 25px;
    color: var(--text-primary);
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.2);
}

.subscription-btn {
    background: linear-gradient(135deg, #25d366 0%, #20bf5a 100%);
    border: none;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 5px 20px rgba(37, 211, 102, 0.3);
}

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

.subscription-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
    background: linear-gradient(135deg, #20bf5a 0%, #1da851 100%);
}

.subscription-btn:hover::before {
    left: 100%;
}

.subscription-note {
    color: var(--text-muted);
    margin-top: 1rem;
}

/* Subscription Modal */
.subscription-modal .modal-content {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.subscription-modal .modal-header {
    background: var(--darker-gradient);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.subscription-modal .modal-title {
    font-weight: 600;
    font-size: 1.3rem;
}

.whatsapp-large-icon {
    font-size: 5rem;
    color: #25d366;
    text-shadow: 0 0 30px rgba(37, 211, 102, 0.6);
    animation: pulse 2s infinite;
}

.modal-subtitle {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.subscription-modal .form-label {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.subscription-modal .form-control {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    transition: var(--transition);
}

.subscription-modal .form-control:focus {
    background: var(--bg-secondary);
    border-color: #25d366;
    box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.25);
    color: var(--text-primary);
}

.subscription-modal .form-control::placeholder {
    color: var(--text-muted);
}

.subscription-modal .input-group-text {
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 10px 0 0 10px;
}

.subscription-modal .form-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.subscription-modal .form-check-input {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

.subscription-modal .form-check-input:checked {
    background-color: #25d366;
    border-color: #25d366;
}

.subscription-modal .form-check-label {
    color: var(--text-secondary);
}

.subscription-modal .form-check-label a {
    color: var(--accent-teal);
    text-decoration: underline;
}

.subscription-btn-modal {
    background: linear-gradient(135deg, #25d366 0%, #20bf5a 100%);
    border: none;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 10px;
    transition: var(--transition);
    box-shadow: 0 5px 20px rgba(37, 211, 102, 0.3);
}

.subscription-btn-modal:hover {
    background: linear-gradient(135deg, #20bf5a 0%, #1da851 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
}

.subscription-benefits {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.subscription-benefits h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.subscription-benefits small {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Success Modal */
.success-modal .modal-content {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.success-icon {
    font-size: 5rem;
    color: #25d366;
    text-shadow: 0 0 30px rgba(37, 211, 102, 0.6);
    animation: successPulse 1.5s ease-in-out;
}

.success-title {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.success-message {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

.success-details {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.success-phone, .success-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
}

/* Animations */
@keyframes successPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Reddit Meme Styling */
.meme-meta {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.subreddit-badge {
    background: var(--darker-gradient);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-primary) !important;
}

.subreddit-badge .fa-reddit-alien {
    color: #ff4500;
}

.upvotes {
    color: var(--accent-teal) !important;
    font-weight: 500;
}

.upvotes .fa-arrow-up {
    color: #ff8b60;
}

.author-info {
    color: var(--text-muted) !important;
}

.reddit-btn {
    background: #ff4500;
    border: none;
    color: white;
    margin-left: 0.25rem;
    transition: var(--transition);
}

.reddit-btn:hover {
    background: #cc3700;
    color: white;
    transform: translateY(-1px);
}

.btn-group {
    display: flex;
    gap: 0.25rem;
}

.view-full-btn {
    background: var(--success-gradient);
    border: none;
    color: white;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    transition: var(--transition);
}

.view-full-btn:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-1px);
}

/* Subscription Responsive Design */
@media (max-width: 768px) {
    .subscription-title {
        font-size: 1.8rem;
    }
    
    .subscription-subtitle {
        font-size: 1rem;
    }
    
    .whatsapp-icon {
        font-size: 3rem;
    }
    
    .whatsapp-large-icon {
        font-size: 4rem;
    }
    
    .feature-item {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    
    .subscription-btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
    }

    .meme-meta {
        font-size: 0.8rem;
    }
    
    .subreddit-badge {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }

    .subreddit-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
        margin: 0.2rem;
    }

    .subreddit-selection h5 {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .subscription-card {
        margin: 0 1rem;
    }
    
    .subscription-title {
        font-size: 1.5rem;
    }
    
    .modal-subtitle {
        font-size: 1.3rem;
    }
    
    .success-title {
        font-size: 1.5rem;
    }
} 