/* ============================================================
   STYLES.CSS - MAIN SITE STYLES
   Modern Design System for MemeGet
   ============================================================ */

/* ============================================================
   SEARCH RESULTS - USERS & MEMES
   ============================================================ */

.search-section {
    margin-bottom: 40px;
    break-inside: avoid; /* Prevent masonry from breaking this section */
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: block;
}

.search-section-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.user-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
}

.user-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

.user-card-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.user-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.user-card-info {
    flex: 1;
    min-width: 0;
}

.user-card-name {
    font-weight: 600;
    font-size: 16px;
    color: #1e293b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-role-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: #ef4444;
    color: white;
    border-radius: 4px;
    font-weight: 600;
}

.user-following-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: #10b981;
    color: white;
    border-radius: 4px;
    font-weight: 600;
}

.user-card-username {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 6px;
}

.user-card-stats {
    font-size: 13px;
    color: #94a3b8;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ============================================================
   GLOBAL RESET & BASE STYLES
   ============================================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   HERO HEADER - HIDDEN (Removed from front page)
   ============================================================ */
.hero-header {
    display: none !important;
}

.hero-header-old {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 60px 20px;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Hero Background Overlay */
.hero-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/images/hero-image.jpg') center/cover;
    opacity: 0.2;
    z-index: 0;
}

/* Hero Content Container */
.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

/* Main Heading */
h1 {
    margin: 0 0 24px 0;
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   NO MEMES MESSAGE
   ============================================================ */
.no-memes {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 16px;
}

/* ============================================================
   SEARCH RESULTS HEADER
   ============================================================ */
.search-results-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 15px auto 15px auto;
    max-width: 700px; /* Match meme card width */
    width: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.search-results-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.search-results-text {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.search-results-icon {
    flex-shrink: 0;
}

.search-results-text strong {
    font-weight: 700;
}

.search-results-clear {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
}

.search-clear-text {
    white-space: nowrap;
}

.search-results-clear:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.search-results-clear:active {
    transform: translateY(0);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .search-results-header {
        padding: 12px 14px;
        margin: 12px auto 12px auto;
        border-radius: 10px;
        max-width: 95%;
    }
    
    .search-results-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .search-results-text {
        font-size: 13px;
        gap: 8px;
        text-align: left;
        line-height: 1.4;
    }
    
    .search-results-icon {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .search-results-clear {
        padding: 10px 14px;
        font-size: 13px;
        gap: 6px;
        width: 100%;
        justify-content: center;
    }
    
    .search-results-clear svg {
        width: 14px;
        height: 14px;
    }
}

.upload-button-container {
    text-align: center;
    margin-top: 32px;
}

/* Upload Button */
#upload-btn {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 14px 32px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
}

#upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* ============================================================
   CONTENT AREA (MAIN CONTAINER)
   ============================================================ */
.content-area {
    background-color: var(--background);
    padding: 40px 20px;
    overflow: visible;
}

/* ============================================================
   MAIN CONTENT WRAPPER - CONSTRAINS ALL CONTENT
   ============================================================ */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 50; /* Ensure main content appears above sidebar */
}

/* ============================================================
   FILTER SECTION - FULL WIDTH BORDER, 700PX BUTTONS
   ============================================================ */
.filters {
    background: white;
    padding: 0;
    margin: 0 0 20px 0;
    border-bottom: 2px solid #e5e7eb;
    position: relative;
    z-index: 150;
    box-sizing: border-box;
    width: 100vw; /* Full viewport width for border */
    margin-left: calc(-50vw + 50%); /* Break out of container */
}

/* Mobile: Add top margin to prevent header overlap */
@media (max-width: 768px) {
    .filters {
        margin-top: 50px;
    }
}

.filter-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    max-width: 700px; /* Match meme card width */
    width: 100%;
    margin: 0 auto; /* Center the buttons */
    padding: 0 20px; /* Match #meme-grid padding */
    gap: 0; /* No gap between buttons */
    box-sizing: border-box;
}

.filter-btn {
    background: transparent;
    border: none;
    padding: 16px 0; /* Zero horizontal padding for perfect alignment */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    white-space: nowrap;
    overflow: visible; /* Allow stars to escape button boundaries! */
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.filter-icon {
    display: none;
}

/* Hover: Gentle lift with background */
.filter-btn:hover:not(.active) {
    background: rgba(102, 126, 234, 0.08);
    color: #667eea;
    transform: translateY(-3px);
}

/* Active: Purple gradient with pulsing glow AND SPARKLES! */
.filter-btn.active {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: buttonPulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4),
                0 0 40px rgba(118, 75, 162, 0.3);
    transform: translateY(0);
}

/* Sparkle particle container */
.sparkle-particle {
    position: absolute;
    font-size: 12px;
    pointer-events: none;
    will-change: transform, opacity;
    z-index: 1000;
}

/* Pulse animation when clicked */
@keyframes buttonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

/* Flowing wave animation */
@keyframes waveFlow {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

/* ============================================================
   PLACEHOLDER STYLES
   ============================================================ */
.placeholder {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 2px dashed var(--border-color);
    color: var(--text-secondary);
}

/* ============================================================
   MODAL SYSTEM
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Content Container */
.modal-content {
    background-color: var(--background);
    margin: 5% auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.3s ease;
    overflow-y: auto;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.modal-content h2 {
    margin: 0;
    padding: 24px 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    font-size: 24px;
    font-weight: 600;
}

/* Modal Close Button */
.close {
    color: #475569;
    float: right;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.close:hover {
    color: #1e293b;
    transform: rotate(90deg);
}

/* ============================================================
   FORM STYLES
   ============================================================ */
form {
    padding: 32px;
}

/* Form Group Container */
.form-group {
    margin-bottom: 24px;
}

/* Form Labels */
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

/* Form Input Fields */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--background);
    color: var(--text-primary);
}

/* Input Focus State */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Textarea Specific */
.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* File Input Specific */
.form-group input[type="file"] {
    padding: 10px;
    cursor: pointer;
}

/* ============================================================
   IMAGE PREVIEW SECTION
   ============================================================ */
#image-preview {
    margin-top: 16px;
    text-align: center;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
}

#image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Delete Image Button */
#delete-image {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-top: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#delete-image:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ============================================================
   TAG INPUT SYSTEM
   ============================================================ */
.tag-input {
    display: flex;
    gap: 8px;
}

.tag-input input {
    flex: 1;
}

/* Add Tag Button */
.tag-input button,
#add-tag-btn,
#edit-add-tag-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tag-input button:hover,
#add-tag-btn:hover,
#edit-add-tag-btn:hover {
    background-color: #475569;
    transform: translateY(-1px);
}

/* Added Tags Container */
.added-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* Tag Pills */
.tag-pill {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.tag-pill:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Tag Remove Button */
.tag-remove {
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s ease;
}

.tag-remove:hover {
    transform: scale(1.2);
}

/* ============================================================
   CATEGORY SECTION
   ============================================================ */
.new-category-section {
    margin-top: 16px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
}

.new-category-section input {
    margin-bottom: 12px;
}

/* Add Category Button */
#add-category-btn,
#edit-add-category-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    transition: all 0.2s ease;
}

#add-category-btn:hover,
#edit-add-category-btn:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Suggest Category Link */
.suggest-link {
    color: var(--primary-color);
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    display: inline-block;
    margin-top: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.suggest-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ============================================================
   SUBMIT BUTTONS
   ============================================================ */
.submit-btn,
button[type="submit"] {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    margin-top: 8px;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.submit-btn:hover,
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ============================================================
   CHECKBOX STYLES
   ============================================================ */
.form-group label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

/* ============================================================
   RESPONSIVE DESIGN - MASONRY GRID
   ============================================================ */

/* Disable masonry for search results */
#meme-grid.search-results {
    column-count: 1 !important;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 1200px) {
    #meme-grid {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    /* Heading Adjustments */
    h1 {
        font-size: 32px;
    }
    
    /* Modal Adjustments */
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    form {
        padding: 24px;
    }
    
    /* Grid Adjustments */
    #meme-grid {
        column-count: 2;
        column-gap: 16px;
        padding: 0 12px;
    }
    
    .meme-card {
        margin-bottom: 16px;
    }
    
    /* Hide hero when mobile searching */
    body.mobile-searching .hero-header {
        display: none;
    }
}

@media (max-width: 480px) {
    /* Heading Adjustments */
    h1 {
        font-size: 24px;
    }
    
    /* Filter buttons remain horizontal */
    .filter-container {
        justify-content: center;
        gap: 8px;
    }
    
    .filter-btn {
        flex: 1;
        min-width: 0;
        padding: 16px 12px;
        font-size: 13px;
    }
    
    .filter-icon {
        width: 18px;
        height: 18px;
    }
    
    /* Single Column Grid */
    #meme-grid {
        column-count: 1;
    }
}

/* ============================================================
   CLICKABLE TAGS - ALL LINK STATES
   ============================================================ */
.clickable-tag,
.clickable-tag:link,
.clickable-tag:visited,
.clickable-tag:active {
    display: inline-block;
    background: #3b82f6;
    color: white !important;  /* ← Force white */
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    margin: 4px;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.clickable-tag:hover {
    background: #2563eb;
    color: white !important;  /* ← Force white on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* ============================================================
   CLICKABLE CATEGORY - FORCE WHITE WITH WRAPPER
   ============================================================ */
.category-wrapper a,
.category-wrapper a:link,
.category-wrapper a:visited,
.category-wrapper a:hover,
.category-wrapper a:active,
.category-wrapper a:focus {
    display: inline-block;
    background: #2563eb !important;
    color: #ffffff !important;  /* ← Hex instead of keyword */
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.category-wrapper a:hover {
    background: #1d4ed8 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* ============================================================
   AVATAR LOADING ANIMATION SYSTEM
   ============================================================ */

/* Hide alt text before image loads */
img[alt] {
    color: transparent;
    font-size: 0;
}

/* Avatar loading state - skeleton shimmer */
.user-card-avatar,
.user-avatar,
.search-result-avatar,
.mobile-search-avatar,
.comment-avatar,
[class*="avatar"] {
    opacity: 0;
    animation: fadeInAvatar 0.6s ease forwards;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: fadeInAvatar 0.6s ease forwards, shimmer 1.5s infinite;
}

/* Avatar fade-in animation */
@keyframes fadeInAvatar {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Skeleton shimmer effect */
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Once image is loaded, stop shimmer and show image */
img[class*="avatar"]:not([src=""]) {
    animation: fadeInAvatar 0.6s ease forwards;
    background: none;
}

/* Default avatar initials (blue circle) - also gets animation */
.default-avatar,
[style*="background"][style*="display: flex"] {
    opacity: 0;
    animation: fadeInAvatar 0.6s ease forwards;
}
