/**
 * NAC Gallery Styles
 * 
 * 3D flip card gallery with responsive grid layout.
 *
 * @package LDBY_Artworks_Download
 * @version 1.0.0
 */

/* ========================================
   CSS Custom Properties
   ======================================== */
:root {
    --nac-primary: #4a9b52;
    --nac-primary-hover: #5cb865;
    --nac-secondary: #6b8f71;
    --nac-accent: #f4a460;
    --nac-text: #ffffff;
    --nac-text-light: #cccccc;
    --nac-text-dark: #333333;
    --nac-bg: #ffffff;
    --nac-bg-overlay: rgba(0, 0, 0, 0.85);
    --nac-border: #444444;
    --nac-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --nac-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.4);
    --nac-radius: 8px;
    --nac-transition: 0.3s ease;
    --nac-flip-duration: 0.6s;
    --nac-gap: 16px;
}

/* ========================================
   Gallery Container
   ======================================== */
.nac-gallery-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--nac-gap);
    box-sizing: border-box;
}

/* Loading State */
.nac-gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--nac-text);
}

/* ========================================
   Category Filters
   ======================================== */
.nac-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--nac-border);
}

/* Featured filter button */
.nac-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 14px;
    color: var(--nac-text);
    cursor: pointer;
    transition: all var(--nac-transition);
    font-family: inherit;
}

.nac-filter-btn:hover {
    border-color: #9ed4b7;
    background: rgba(158, 212, 183, 0.3);
}

.nac-filter-btn.active {
    background: #9ed4b7;
    border-color: #9ed4b7;
    color: #292a2e;
}

.nac-featured-filter {
    font-weight: 600;
}

.nac-filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 14px;
    color: var(--nac-text);
    cursor: pointer;
    transition: all var(--nac-transition);
    user-select: none;
}

.nac-filter-checkbox:hover {
    border-color: #9ed4b7;
    background: rgba(158, 212, 183, 0.3);
}

.nac-filter-checkbox.active {
    background: #9ed4b7;
    border-color: #9ed4b7;
    color: #292a2e;
}

.nac-filter-checkbox input[type="checkbox"] {
    display: none;
}

/* Responsive filters - tablets */
@media (max-width: 768px) {
    .nac-category-filters {
        gap: 8px;
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
    
    .nac-filter-btn,
    .nac-filter-checkbox {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Responsive filters - phones */
@media (max-width: 480px) {
    .nac-category-filters {
        gap: 6px;
        margin-bottom: 20px;
        padding-bottom: 16px;
        justify-content: center;
    }
    
    .nac-filter-btn,
    .nac-filter-checkbox {
        padding: 8px 14px;
        font-size: 13px;
        flex: 0 0 auto;
    }
    
    .nac-gallery-container {
        padding: 12px;
    }
}

.nac-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--nac-border);
    border-top-color: var(--nac-primary);
    border-radius: 50%;
    animation: nac-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* ========================================
   Gallery Grid
   ======================================== */
.nac-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: var(--nac-gap);
}

/* Responsive Grid */
/* Large tablets and small desktops */
@media (max-width: 1200px) {
    .nac-gallery-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* Tablets landscape */
@media (max-width: 992px) {
    .nac-gallery-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 14px;
    }
}

/* Small tablets and landscape phones */
@media (max-width: 768px) {
    .nac-gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
}

/* Portrait phones */
@media (max-width: 480px) {
    .nac-gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
        max-width: 320px;
        margin: 0 auto;
    }
}

/* ========================================
   Flip Card
   ======================================== */
.nac-flip-card {
    perspective: 1000px;
    aspect-ratio: 1 / 1;
    cursor: pointer;
}

.nac-flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform var(--nac-flip-duration) ease;
    transform-style: preserve-3d;
}

/* Flip on hover (desktop) */
@media (hover: hover) {
    .nac-flip-card:hover .nac-flip-card-inner {
        transform: rotateY(180deg);
    }
}

/* Flip when active class added (mobile touch) */
.nac-flip-card.is-flipped .nac-flip-card-inner {
    transform: rotateY(180deg);
}

/* Card Faces */
.nac-flip-card-front,
.nac-flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--nac-radius);
    overflow: hidden;
    box-shadow: var(--nac-shadow);
}

/* Front Face - Thumbnail */
.nac-flip-card-front {
    background: var(--nac-bg);
}

.nac-flip-card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Placeholder when no image */
.nac-flip-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--nac-secondary) 0%, var(--nac-primary) 100%);
    color: white;
    font-size: 14px;
    text-align: center;
    padding: 16px;
    box-sizing: border-box;
}

/* Back Face - Info */
.nac-flip-card-back {
    background: #017aa9;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    padding: 16px;
    box-sizing: border-box;
    color: #ffffff;
}

.nac-flip-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
    color: #ffffff;
}

.nac-flip-card-description {
    font-size: 13px;
    line-height: 1.5;
    color: #ffffff;
    flex: 1;
    overflow-y: auto;
    margin: 0 0 12px 0;
}

/* Custom scrollbar for description */
.nac-flip-card-description::-webkit-scrollbar {
    width: 4px;
}

.nac-flip-card-description::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.nac-flip-card-description::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

/* Download Button */
.nac-download-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: #ffffff;
    color: #292a2e;
    border: none;
    border-radius: var(--nac-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--nac-transition), transform var(--nac-transition);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nac-download-btn:hover {
    background: #f0f0f0;
    transform: scale(1.02);
}

.nac-download-btn:active {
    transform: scale(0.98);
}

/* Responsive card content - Small tablets and landscape phones */
@media (max-width: 768px) {
    .nac-flip-card-back {
        padding: 10px;
    }
    
    .nac-flip-card-title {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .nac-flip-card-description {
        font-size: 11px;
        line-height: 1.4;
        margin-bottom: 8px;
    }
    
    .nac-download-btn {
        padding: 8px 10px;
        font-size: 11px;
        letter-spacing: 0.3px;
    }
}

/* Portrait phones - larger cards, better readability */
@media (max-width: 480px) {
    .nac-flip-card-back {
        padding: 20px;
    }
    
    .nac-flip-card-title {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .nac-flip-card-description {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 16px;
    }
    
    .nac-download-btn {
        padding: 14px 20px;
        font-size: 15px;
        letter-spacing: 0.5px;
    }
    
    .nac-flip-card-placeholder {
        font-size: 16px;
        padding: 20px;
    }
}

/* ========================================
   Load More Button
   ======================================== */
.nac-load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

.nac-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--nac-primary);
    color: white;
    border: none;
    border-radius: var(--nac-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--nac-transition), transform var(--nac-transition);
}

.nac-load-more-btn:hover:not(:disabled) {
    background: var(--nac-primary-hover);
    transform: translateY(-2px);
}

.nac-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nac-load-more-btn .nac-spinner {
    width: 18px;
    height: 18px;
    border-width: 2px;
    margin: 0;
}

/* ========================================
   Email Modal
   ======================================== */
.nac-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.nac-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.nac-modal-box {
    background: white;
    border-radius: var(--nac-radius);
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.nac-modal-overlay.is-visible .nac-modal-box {
    transform: translateY(0);
}

.nac-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--nac-border);
}

.nac-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--nac-text-dark);
}

.nac-modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color var(--nac-transition);
}

.nac-modal-close-btn:hover {
    color: var(--nac-text-dark);
}

.nac-modal-body {
    padding: 24px;
}

.nac-form-field {
    margin-bottom: 20px;
}

.nac-form-field:last-child {
    margin-bottom: 0;
}

.nac-form-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--nac-text-dark);
}

.nac-zip-lookup-link {
    font-weight: normal;
    font-size: 12px;
    color: #017aa9;
    text-decoration: none;
    margin-left: 8px;
}

.nac-zip-lookup-link:hover {
    text-decoration: underline;
}

.nac-form-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dddddd;
    border-radius: var(--nac-radius);
    font-size: 16px;
    color: var(--nac-text-dark);
    background: white;
    transition: border-color var(--nac-transition), box-shadow var(--nac-transition);
    box-sizing: border-box;
}

.nac-form-field input:focus {
    outline: none;
    border-color: #017aa9;
    box-shadow: 0 0 0 3px rgba(1, 122, 169, 0.15);
}

.nac-form-field input.has-error {
    border-color: #dc3545;
}

.nac-field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
}

.nac-modal-footer {
    padding: 16px 24px 24px;
}

.nac-submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: #017aa9;
    color: white;
    border: none;
    border-radius: var(--nac-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--nac-transition);
    display: block;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.nac-submit-btn:hover:not(:disabled) {
    background: #015f84;
}

.nac-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Quick Download Confirmation */
.nac-confirm-message {
    text-align: center;
    padding: 20px 0;
}

.nac-confirm-message p {
    margin: 0 0 8px 0;
    color: var(--nac-text);
}

.nac-confirm-message .nac-user-info {
    font-weight: 600;
    color: #017aa9;
}

.nac-confirm-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.nac-confirm-actions button {
    flex: 1;
}

.nac-btn-secondary {
    background: var(--nac-border);
    color: var(--nac-text);
}

.nac-btn-secondary:hover {
    background: #d0d0d0;
}

/* ========================================
   Success/Error Messages
   ======================================== */
.nac-message {
    padding: 12px 16px;
    border-radius: var(--nac-radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.nac-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.nac-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========================================
   No Artworks State
   ======================================== */
.nac-no-artworks {
    text-align: center;
    padding: 60px 20px;
    color: var(--nac-text);
}

.nac-no-artworks-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.nac-no-artworks h3 {
    margin: 0 0 8px 0;
    color: var(--nac-text);
    font-weight: 600;
}

.nac-no-artworks p {
    margin: 0;
    color: var(--nac-text-light);
}

/* ========================================
   Animations
   ======================================== */
@keyframes nac-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nac-flip-card {
    animation: nac-fade-in 0.4s ease backwards;
}

/* Stagger animation for cards */
.nac-flip-card:nth-child(1) { animation-delay: 0.05s; }
.nac-flip-card:nth-child(2) { animation-delay: 0.1s; }
.nac-flip-card:nth-child(3) { animation-delay: 0.15s; }
.nac-flip-card:nth-child(4) { animation-delay: 0.2s; }
.nac-flip-card:nth-child(5) { animation-delay: 0.25s; }
.nac-flip-card:nth-child(6) { animation-delay: 0.3s; }
.nac-flip-card:nth-child(7) { animation-delay: 0.35s; }
.nac-flip-card:nth-child(8) { animation-delay: 0.4s; }
.nac-flip-card:nth-child(9) { animation-delay: 0.45s; }
.nac-flip-card:nth-child(10) { animation-delay: 0.5s; }

/* ========================================
   Responsive Modal
   ======================================== */
@media (max-width: 480px) {
    .nac-modal-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .nac-modal-box {
        max-width: 100%;
        max-height: calc(100vh - 80px);
        border-radius: 12px;
    }
    
    .nac-modal-header {
        padding: 16px 20px;
    }
    
    .nac-modal-header h3 {
        font-size: 18px;
    }
    
    .nac-modal-close-btn {
        font-size: 24px;
    }
    
    .nac-modal-body {
        padding: 20px;
    }
    
    .nac-form-field {
        margin-bottom: 16px;
    }
    
    .nac-form-field label {
        font-size: 13px;
    }
    
    .nac-form-field input {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .nac-modal-footer {
        padding: 12px 20px 20px;
    }
    
    .nac-submit-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .nac-confirm-message {
        padding: 10px 0;
    }
    
    .nac-confirm-message .nac-user-info {
        font-size: 15px;
    }
}

/* ========================================
   Responsive Load More Button
   ======================================== */
@media (max-width: 480px) {
    .nac-load-more-container {
        margin-top: 24px;
    }
    
    .nac-load-more-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
        font-size: 15px;
    }
}

/* ========================================
   Responsive No Artworks State
   ======================================== */
@media (max-width: 480px) {
    .nac-no-artworks {
        padding: 40px 16px;
    }
    
    .nac-no-artworks-icon {
        font-size: 40px;
    }
    
    .nac-no-artworks h3 {
        font-size: 18px;
    }
    
    .nac-no-artworks p {
        font-size: 14px;
    }
}
