main.gallery-container-main {
    padding-top: 100px; /* Adjust based on header height */
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* Gallery Specific Styles */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
}



/* Gallery Header */
.gallery-header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

/* Large screen specific adjustments */
@media (min-width: 1400px) {
    .container {
        max-width: 1350px;
        padding: 0 50px;
    }
    
    .main-gallery-grid {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(3, 320px);
        max-width: 1250px;
        gap: 18px;
    }
    
    .top-three-container {
        max-width: 950px;
        gap: 25px;
    }
}

.gallery-hero {
    margin-bottom: 30px;
}

.gallery-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(45deg, #4DA2FF, #6db9ff, #90d1ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    text-shadow: 0 0 30px rgba(77, 162, 255, 0.3);
}

.gallery-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted, #b0b0b0);
    margin-bottom: 30px;
    line-height: 1.6;
}

.gallery-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    background: rgba(77, 162, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(77, 162, 255, 0.2);
    min-width: 120px;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #4DA2FF;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted, #b0b0b0);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-light, #ffffff);
    white-space: nowrap;
}

.filter-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(77, 162, 255, 0.3);
    border-radius: 10px;
    padding: 10px 15px;
    color: var(--text-light, #ffffff);
    font-size: 1rem;
    min-width: 150px;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #4DA2FF;
    box-shadow: 0 0 10px rgba(77, 162, 255, 0.3);
}

.filter-select option {
    background: var(--bg-secondary, #1a1a1a);
    color: var(--text-light, #ffffff);
}

/* Section Titles */
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-light, #ffffff);
    margin-bottom: 25px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Top 3 Section */
.top-three-section {
    margin-bottom: 60px;
}

.top-three-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 25px;
    box-sizing: border-box;
}

.top-meme-card {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid #4DA2FF;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(77, 162, 255, 0.2);
    display: flex;
    flex-direction: column;
    min-height: 350px;
}

.top-meme-card img {
    width: 100%;
    flex: 1;
    object-fit: contain;
    object-position: center;
    display: block;
    background: rgba(0, 0, 0, 0.1);
}

.top-meme-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(77, 162, 255, 0.3);
}

.top-meme-card[data-rank="1"] {
    border-color: #FFD700;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

.top-meme-card[data-rank="2"] {
    border-color: #C0C0C0;
    box-shadow: 0 10px 30px rgba(192, 192, 192, 0.3);
}

.top-meme-card[data-rank="3"] {
    border-color: #CD7F32;
    box-shadow: 0 10px 30px rgba(205, 127, 50, 0.3);
}

.rank-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.top-meme-card[data-rank="2"] .rank-badge {
    background: linear-gradient(45deg, #C0C0C0, #A8A8A8);
}

.top-meme-card[data-rank="3"] .rank-badge {
    background: linear-gradient(45deg, #CD7F32, #B8860B);
}

.top-meme-card .meme-overlay {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    border-radius: 0 0 20px 20px;
}

/* Main Gallery Grid */
.main-gallery-section {
    margin-bottom: 60px;
}

.main-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 350px); /* Match top 3 card height */
    gap: 15px;
    margin-bottom: 40px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.meme-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(77, 162, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 330px; /* Match top 3 card height minus some padding */
}

.meme-card img {
    width: 100%;
    height: 230px; /* Increased height to match top 3 proportions */
    object-fit: contain;
    object-position: center;
    border-radius: 15px 15px 0 0;
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.meme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(77, 162, 255, 0.2);
    border-color: #4DA2FF;
}

.meme-overlay {
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 12px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100px;
    border-radius: 0 0 15px 15px;
    flex-shrink: 0;
}

.meme-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.vote-count, .like-count {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #4DA2FF;
    font-weight: 600;
}

.social-actions {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.btn-social {
    flex: 1;
    background: rgba(77, 162, 255, 0.2);
    border: 1px solid rgba(77, 162, 255, 0.3);
    color: white;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 28px;
}

.btn-social:hover:not(:disabled) {
    background: rgba(77, 162, 255, 0.4);
    border-color: #4DA2FF;
    transform: translateY(-2px);
}

.btn-social:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-vote.voted {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
    color: #4CAF50;
}

.btn-like.liked {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
    color: #4CAF50;
    animation: heartBeat 0.6s ease;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
}

.pagination-btn {
    background: rgba(77, 162, 255, 0.2);
    border: 1px solid rgba(77, 162, 255, 0.3);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(77, 162, 255, 0.4);
    border-color: #4DA2FF;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #4DA2FF;
    border-color: #4DA2FF;
}

.pagination-info {
    color: var(--text-muted, #b0b0b0);
    font-size: 0.9rem;
}

/* Share Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

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

.modal-content {
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(77, 162, 255, 0.3);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(77, 162, 255, 0.2);
}

.modal-header h3 {
    color: var(--text-light, #ffffff);
    font-size: 1.3rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted, #b0b0b0);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

.share-preview {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid rgba(77, 162, 255, 0.2);
}

#shareText {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(77, 162, 255, 0.3);
    border-radius: 10px;
    padding: 15px;
    color: var(--text-light, #ffffff);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 20px;
}

#shareText:focus {
    outline: none;
    border-color: #4DA2FF;
    box-shadow: 0 0 10px rgba(77, 162, 255, 0.3);
}

.hashtag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.hashtag-btn {
    background: rgba(77, 162, 255, 0.2);
    border: 1px solid rgba(77, 162, 255, 0.3);
    color: #4DA2FF;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.hashtag-btn:hover {
    background: rgba(77, 162, 255, 0.3);
    border-color: #4DA2FF;
}

.modal-footer {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn.primary {
    background: linear-gradient(45deg, #4DA2FF, #6db9ff);
    color: white;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(77, 162, 255, 0.3);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light, #ffffff);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Loading States */
.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    color: var(--text-muted, #b0b0b0);
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

.loading-placeholder i {
    font-size: 1.5rem;
    color: #4DA2FF;
}

/* Notification System */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.notification {
    background: var(--bg-secondary, #1a1a1a);
    border-left: 4px solid #4DA2FF;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
}

.notification.success {
    border-left-color: #4CAF50;
}

.notification.error {
    border-left-color: #F44336;
}

.notification.warning {
    border-left-color: #FF9800;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        padding: 0 30px;
        max-width: 1000px;
    }
    
    .main-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(5, 300px);
        max-width: 750px;
        padding: 0 20px;
        gap: 15px;
    }
}

@media (max-width: 968px) {
    .container {
        padding: 0 25px;
        max-width: 700px;
    }
    
    .main-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(8, 280px);
        padding: 0 15px;
        max-width: 500px;
        gap: 12px;
    }
    
    .meme-card {
        height: 260px;
    }
    
    .meme-card img {
        height: 170px;
    }
    
    .meme-overlay {
        height: 90px;
        padding: 12px 10px;
    }
    
    .top-three-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 20px;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .gallery-container {
        padding: 15px;
        margin-top: 70px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .gallery-title {
        font-size: 2rem;
    }
    
    .gallery-stats {
        gap: 20px;
    }
    
    .stat-item {
        padding: 15px;
        min-width: 100px;
    }
    
    .filter-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .filter-select {
        width: 100%;
        min-width: auto;
    }
    
    .main-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(8, 260px);
        gap: 15px;
        padding: 0 5px;
    }
    
    .meme-card {
        height: 240px;
    }
    
    .meme-card img {
        height: 150px;
    }
    
    .meme-overlay {
        height: 90px;
        padding: 10px 8px;
    }
    
    .modal-content {
        padding: 20px;
        width: 95%;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .gallery-title {
        font-size: 1.8rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .main-gallery-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(15, 360px); /* Increased height for bigger images */
        padding: 0;
    }
    
    .meme-card {
        height: 340px; /* Increased to match grid height */
    }
    
    .meme-card img {
        height: 220px; /* Increased image height */
        object-fit: contain;
        width: 100%;
    }
    
    .meme-overlay {
        height: 120px; /* Maintained space for buttons */
        padding: 8px 10px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .meme-stats {
        display: flex;
        justify-content: space-between;
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .meme-card .social-actions {
        display: flex !important;
        flex-direction: row !important;
        gap: 6px !important;
        justify-content: space-between !important;
        width: 100% !important;
        margin-top: auto !important;
    }
    
    .meme-card .btn-social {
        font-size: 10px !important;
        padding: 8px 6px !important;
        min-width: auto !important;
        flex: 1 !important;
        border-radius: 6px !important;
        white-space: nowrap !important;
        min-height: 34px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        text-decoration: none !important;
        /* Match top 3 card button styles */
        background: rgba(77, 162, 255, 0.2) !important;
        border: 1px solid rgba(77, 162, 255, 0.3) !important;
        color: white !important;
        transition: all 0.3s ease !important;
    }
    
    .meme-card .btn-social:hover:not(:disabled) {
        background: rgba(77, 162, 255, 0.4) !important;
        border-color: #4DA2FF !important;
        transform: translateY(-2px) !important;
    }
    
    .meme-card .btn-social i {
        margin-right: 2px !important;
        font-size: 10px !important;
    }
    
    /* Special states with distinct colors only for visual feedback */
    .meme-card .btn-vote:disabled {
        background: rgba(102, 102, 102, 0.2) !important;
        border-color: rgba(102, 102, 102, 0.3) !important;
        opacity: 0.7 !important;
    }
    
    .meme-card .btn-vote.voted {
        background: rgba(76, 175, 80, 0.3) !important;
        border-color: #4CAF50 !important;
        color: #4CAF50 !important;
    }
    
    .meme-card .btn-like.liked {
        background: rgba(76, 175, 80, 0.3) !important;
        border-color: #4CAF50 !important;
        color: #4CAF50 !important;
    }
    
    .pagination-container {
        flex-wrap: wrap;
        gap: 10px;
    }
}