/* ====================================
   TextileWall Gallery - Styles
   ==================================== */

.tw-gallery-page {
    min-height: 100vh;
}

/* Hero Section */
.tw-gallery-hero {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 80px 0 60px;
    text-align: center;
}

.tw-gallery-title {
    font-size: 3rem;
    font-weight: 800;
    margin: 0 0 16px;
    color: white !important;
}

.tw-gallery-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    margin: 0;
    color: white !important;
}

/* Container */
.tw-gallery-container {
    padding: 60px 0;
}

/* Search Bar */
.tw-gallery-search {
    margin-bottom: 40px;
}

.tw-search-wrapper {
    display: flex;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
    align-items: center;
}

.tw-search-input {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.3s;
}

.tw-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.tw-search-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.tw-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.tw-clear-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tw-clear-btn:hover {
    background: #4b5563;
}

/* Category Filters */
.tw-gallery-filters {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 50px;
}

.tw-filter-btn {
    background: white;
    color: #1a1a1a;
    border: 2px solid #e5e7eb;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tw-filter-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-2px);
}

.tw-filter-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Loading Indicator */
.tw-gallery-loading {
    text-align: center;
    padding: 60px 20px;
}

.tw-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: tw-spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes tw-spin {
    to { transform: rotate(360deg); }
}

.tw-gallery-loading p {
    color: #6b7280;
    font-size: 1rem;
}

/* Gallery Grid */
.tw-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.tw-gallery-item {
    transition: opacity 0.3s, transform 0.3s;
}

.tw-gallery-item.hidden {
    display: none;
}

.tw-gallery-image-wrapper {
    position: relative;
    background: #f9fafb;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 20px 60px -15px rgba(0, 0, 0, 0.08);
}

.tw-gallery-image-wrapper:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 30px 80px -20px rgba(59, 130, 246, 0.15);
}

.tw-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.tw-gallery-image-wrapper:hover .tw-gallery-image {
    transform: scale(1.05);
}

/* Overlay */
.tw-gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.85) 50%, rgba(0,0,0,0.4) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    color: white;
}

.tw-gallery-image-wrapper:hover .tw-gallery-overlay {
    opacity: 1;
}

.tw-gallery-item-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: white !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.tw-gallery-item-desc {
    font-size: 0.9rem;
    margin: 0 0 16px;
    color: white !important;
    opacity: 1;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.tw-gallery-select-btn {
    background: white;
    color: #3b82f6;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    align-self: flex-start;
}

.tw-gallery-select-btn:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-2px);
}

/* Load More */
.tw-gallery-load-more-wrapper {
    text-align: center;
    margin-top: 50px;
}

.tw-load-more-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tw-load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

/* Empty State */
.tw-gallery-empty {
    text-align: center;
    padding: 80px 20px;
    color: #6b7280;
    font-size: 1.1rem;
}

/* Modal */
.tw-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tw-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.tw-modal-content {
    position: relative;
    background: white;
    border-radius: 24px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.tw-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
}

.tw-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

#tw-modal-image {
    width: 100%;
    display: block;
    border-radius: 24px 24px 0 0;
}

.tw-modal-info {
    padding: 32px;
}

#tw-modal-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 12px;
}

#tw-modal-description {
    font-size: 1.1rem;
    color: #6b7280;
    margin: 0 0 24px;
}

.tw-modal-actions {
    display: flex;
    gap: 12px;
}

.tw-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tw-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.tw-btn-secondary {
    background: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.tw-btn-secondary:hover {
    background: #3b82f6;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .tw-gallery-title {
        font-size: 2rem;
    }
    
    .tw-gallery-subtitle {
        font-size: 1rem;
    }
    
    .tw-search-wrapper {
        flex-direction: column;
    }
    
    .tw-search-btn,
    .tw-clear-btn {
        width: 100%;
    }
    
    .tw-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .tw-modal-actions {
        flex-direction: column;
    }
    
    .tw-btn-primary,
    .tw-btn-secondary {
        width: 100%;
        text-align: center;
    }
}

/* Modal Mode - Hide hero, adjust padding */
body.tw-gallery-modal-mode .tw-gallery-page {
    min-height: 100vh;
    background: #f9fafb;
}

/* Hide hero section in modal mode - multiple selectors for specificity */
body.tw-gallery-modal-mode .tw-gallery-hero,
.tw-gallery-modal-mode .tw-gallery-hero,
.tw-gallery-hero {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

body.tw-gallery-modal-mode .tw-gallery-container {
    padding: 20px 0 !important;
}

body.tw-gallery-modal-mode .container {
    max-width: 100%;
    padding: 0 20px;
}

body.tw-gallery-modal-mode .tw-gallery-search {
    margin-bottom: 20px;
}

body.tw-gallery-modal-mode .tw-search-wrapper {
    max-width: 100%;
}
