/**
 * Studio Gallery - Advanced Styles
 * Premium design for photo gallery with Masonry layout
 */

/* ========================================
   Grid Layout (Replacing Masonry)
   ======================================== */

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin: 0 auto;
    max-width: 100%;
}

.masonry-sizer {
    display: none; /* Not needed for CSS Grid */
}

.masonry-item {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Optional: Keep hidden only if JS is specifically handling it via a loading class */
.js-loading .masonry-item {
    opacity: 0;
    transform: translateY(30px);
}

.masonry-item.fade-in-up {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 640px) {
    .masonry-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ========================================
   Premium Album Cards
   ======================================== */

.album-card {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    will-change: transform, box-shadow;
}

.album-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 150, 136, 0.05) 0%, rgba(0, 85, 102, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    pointer-events: none;
}

.album-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 150, 136, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.1);
}

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

/* Card Image Container */
.album-card-image {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.album-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.album-card:hover .album-card-image img {
    transform: scale(1.15);
}

/* Image Overlay */
.album-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.3) 60%,
            rgba(0, 0, 0, 0.7) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}

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

/* Image Count Badge */
.album-badge {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 150, 136, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    z-index: 3;
    box-shadow: 0 4px 12px rgba(0, 150, 136, 0.3);
    transition: all 0.3s ease;
}

.album-card:hover .album-badge {
    transform: scale(1.1);
    background: rgba(0, 150, 136, 1);
}

/* Card Content */
.album-card-content {
    padding: 24px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    position: relative;
    z-index: 2;
}

.album-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.album-card:hover .album-card-title {
    color: #00d9c8;
}

.album-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 12px;
}

.album-card-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.album-card-meta-divider {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

/* ========================================
   Filter Bar
   ======================================== */

.filter-bar {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 28px 32px;
    margin-bottom: 48px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 150, 136, 0.1);
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    color: #333;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #009688;
    box-shadow: 0 0 0 4px rgba(0, 150, 136, 0.1);
}

.filter-input::placeholder {
    color: #999;
}

.filter-btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.filter-btn-primary {
    background: linear-gradient(135deg, #009688 0%, #00796b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 150, 136, 0.3);
}

.filter-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 150, 136, 0.4);
}

.filter-btn-secondary {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.filter-btn-secondary:hover {
    border-color: #009688;
    color: #009688;
}

/* ========================================
   Loading States
   ======================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 12px;
}

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

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 400px;
    margin-bottom: 32px;
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.scale-in {
    animation: scaleIn 0.4s ease forwards;
}

/* Stagger animation delays */
.masonry-item:nth-child(1) {
    animation-delay: 0s;
}

.masonry-item:nth-child(2) {
    animation-delay: 0.05s;
}

.masonry-item:nth-child(3) {
    animation-delay: 0.1s;
}

.masonry-item:nth-child(4) {
    animation-delay: 0.15s;
}

.masonry-item:nth-child(5) {
    animation-delay: 0.2s;
}

.masonry-item:nth-child(6) {
    animation-delay: 0.25s;
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 24px;
    border: 2px dashed #e0e0e0;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.empty-state-text {
    font-size: 16px;
    color: #666;
}

/* ========================================
   RTL Support
   ======================================== */

[dir="rtl"] .album-badge {
    right: auto;
    left: 16px;
}

[dir="rtl"] .album-card-meta {
    direction: rtl;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .album-card-image {
        height: 240px;
    }

    .album-card-content {
        padding: 20px;
    }

    .album-card-title {
        font-size: 18px;
    }

    .filter-bar {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .album-card {
        border-radius: 16px;
    }

    .album-card-image {
        height: 200px;
    }

    .filter-bar {
        padding: 16px;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {

    .filter-bar,
    .album-badge {
        display: none;
    }

    .album-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========================================
   Dark Mode Support
   ======================================== */

[data-theme="dark"] .album-card {
    background: #212121;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .album-card:hover {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
        0 10px 30px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .album-card-image {
    background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
}

[data-theme="dark"] .album-card-content {
    background: linear-gradient(135deg, #212121 0%, #282828 100%);
}

[data-theme="dark"] .filter-bar {
    background: linear-gradient(135deg, #212121 0%, #262626 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .filter-input,
[data-theme="dark"] .filter-select {
    background: #181818;
    border-color: rgba(255, 255, 255, 0.12);
    color: #EAEAEA;
}

[data-theme="dark"] .filter-input::placeholder {
    color: #707070;
}

[data-theme="dark"] .filter-btn-secondary {
    background: #212121;
    color: #A0A0A0;
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .filter-btn-secondary:hover {
    border-color: #009688;
    color: #009688;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #212121 25%, #2a2a2a 50%, #212121 75%);
    background-size: 200% 100%;
}

[data-theme="dark"] .empty-state {
    background: linear-gradient(135deg, #212121 0%, #1e1e1e 100%);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .empty-state-icon {
    background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
}

[data-theme="dark"] .empty-state-title {
    color: #EAEAEA;
}

[data-theme="dark"] .empty-state-text {
    color: #A0A0A0;
}