/**
 * Gallery V2 - Styles
 * 
 * Masonry gallery with hover overlay metadata.
 * 
 * @package FlagCreator
 * @since 2.0.0
 */

/* ============================================
   CSS Variables
   ============================================ */
.fc-gallery-v2 {
    --fc-bg: #404854;
    --fc-card-bg: #2d3139;
    --fc-card-border: rgba(255, 255, 255, 0.06);
    --fc-text: #f6f7f9;
    --fc-text-muted: rgba(246, 247, 249, 0.5);
    --fc-text-secondary: rgba(246, 247, 249, 0.7);
    --fc-red: #C60C30;
    --fc-red-dark: #990924;
    --fc-green: #008C45;
    --fc-gap: 16px;
}

/* ============================================
   Container
   ============================================ */
.fc-gallery-v2 {
    max-width: 1400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    color: var(--fc-text);
}

/* ============================================
   Controls Row (Search + Tabs)
   ============================================ */
.fc-gallery-v2__controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* ============================================
   Search
   ============================================ */
.fc-gallery-v2__search {
    flex-shrink: 0;
}

.fc-gallery-v2__search-inner {
    position: relative;
    display: flex;
    align-items: center;
}

.fc-gallery-v2__search-input {
    width: 280px;
    height: 40px;
    padding: 0 16px 0 42px;
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: 8px;
    color: var(--fc-text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

@media (min-width: 900px) {
    .fc-gallery-v2__search-input {
        width: 360px;
    }
}

.fc-gallery-v2__search-input::placeholder {
    color: #999;
    opacity: 1;
}

.fc-gallery-v2__search-input:focus {
    border-color: var(--fc-red);
    box-shadow: 0 0 0 3px rgba(198, 12, 48, 0.15);
}

.fc-gallery-v2__search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--fc-text-muted);
    pointer-events: none;
}

/* ============================================
   Tabs
   ============================================ */
.fc-gallery-v2__tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 45px;
    background: rgba(0, 0, 0, 0.25);
    padding: 0 4px;
    border-radius: 8px;
    box-sizing: border-box;
}

.fc-gallery-v2__tab {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 24px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--fc-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fc-gallery-v2__tab:hover:not(.is-active) {
    color: var(--fc-text);
    background: rgba(255, 255, 255, 0.05);
}

.fc-gallery-v2__tab.is-active {
    background: var(--fc-red);
    color: white;
}

/* ============================================
   Content Sections
   ============================================ */
.fc-gallery-v2__content {
    min-height: 60vh;
}

.fc-gallery-v2__section {
    display: none !important;
}

.fc-gallery-v2__section.is-active {
    display: block !important;
    min-height: 50vh;
}

/* ============================================
   Grid - JS Masonry Layout
   ============================================ */
.fc-gallery-v2__grid {
    position: relative;
    width: 100%;
}

/* Card positioning handled by JavaScript masonry */
.fc-gallery-card {
    position: absolute;
    /* Width set by JS based on column count */
}

@media (max-width: 600px) {
    .fc-gallery-v2__search-input {
        width: 100%;
    }

    .fc-gallery-v2__controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ============================================
   Card
   ============================================ */
.fc-gallery-card {
    background: var(--fc-card-bg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fc-gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

/* Card Content Wrapper */
.fc-gallery-card__inner {
    position: relative;
}

/* Card Image */
.fc-gallery-card__image-link {
    display: block;
    text-decoration: none;
}

.fc-gallery-card__image {
    width: 100%;
    height: auto;
    display: block;
    min-height: 150px;
    background: var(--fc-card-bg);
}

/* ============================================
   Hover Overlay
   ============================================ */
.fc-gallery-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    padding: 30px 12px 12px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.fc-gallery-card:hover .fc-gallery-card__overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Title */
.fc-gallery-card__title {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.fc-gallery-card__title a {
    color: white;
    text-decoration: none;
}

/* Author & Date */
.fc-gallery-card__meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

/* Larger text on desktop */
@media (min-width: 900px) {
    .fc-gallery-card__title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .fc-gallery-card__meta {
        font-size: 13px;
    }

    .fc-gallery-card__overlay {
        padding: 40px 14px 14px;
    }
}

.fc-gallery-card__author {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
}

.fc-gallery-card__author:hover {
    color: white;
}

/* ============================================
   Action Buttons
   ============================================ */
.fc-gallery-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

/* Shared button styles */
.fc-gallery-card__like-btn,
.fc-gallery-card__follow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    border: none;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

/* Like Button */
.fc-gallery-card__like-btn {
    gap: 4px;
    background: rgba(255, 255, 255, 0.15);
    padding: 0 10px;
}

.fc-gallery-card__like-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.fc-gallery-card__like-btn.is-active {
    background: var(--fc-red);
}

.fc-gallery-card__like-btn.is-own {
    cursor: default;
    opacity: 0.6;
}

/* Follow Button */
.fc-gallery-card__follow-btn {
    background: var(--fc-red);
    padding: 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fc-gallery-card__follow-btn:hover {
    background: var(--fc-red-dark);
}

.fc-gallery-card__follow-btn.is-active {
    background: var(--fc-green);
}

.fc-gallery-card__follow-btn.is-own {
    background: rgba(255, 255, 255, 0.15);
    cursor: default;
}

/* ============================================
   Loader (Infinite Scroll)
   ============================================ */
.fc-gallery-v2__loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    margin-top: 20px;
}

.fc-gallery-v2__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--fc-card-border);
    border-top-color: var(--fc-red);
    border-radius: 50%;
    animation: fc-spin 0.8s linear infinite;
}

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

/* End of gallery indicator */
.fc-gallery-v2__grid:after {
    content: '';
    display: block;
    clear: both;
}

/* ============================================
   Empty State
   ============================================ */
.fc-gallery-v2__empty {
    text-align: center;
    padding: 48px;
    color: var(--fc-text-muted);
    font-size: 16px;
}