/* === Gallery Section === */
.gallery-section {
    min-height: 200px; /* Reserve space before content loads */
}

.gallery-header {
    text-align: center;
    margin-bottom: 40px;
}

.gallery-header .gallery-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c2c2c;
    margin-bottom: 10px;
    text-shadow: 1px 1px 0 #d4a574;
}

.gallery-subtitle {
    font-size: 1rem;
    color: #6b6b6b;
    font-style: italic;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    min-height: 150px;
    margin-bottom: 40px;
}

.gallery-item {
    position: relative;
    background: #fff;
    border: 3px solid #2c2c2c;
    transition: all 0.3s ease;
    cursor: pointer;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px dashed #d4a574;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item:hover {
    transform: translate(-3px, -3px);
    box-shadow: 
        8px 8px 0 #d4a574,
        8px 8px 0 3px #2c2c2c;
}

.gallery-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 44, 44, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    text-align: center;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay-text {
    color: #f7f5f0;
    font-family: 'Courier Prime', monospace;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 8px 12px;
    border: 2px solid #d4a574;
    background: rgba(212, 165, 116, 0.1);
    margin-bottom: 15px;
}

.gallery-overlay .gallery-new-title {
    color: #f7f5f0;
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.gallery-prompt-box {
    background: #f7f5f0;
    
    padding: 12px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-prompt-box:hover {
    background: #d4a574;
    transform: translateY(-2px);
}

.prompt-preview {
    font-family: 'Courier Prime', monospace;
    font-size: 12px;
    color: #2c2c2c;
    font-style: italic;
    line-height: 1.3;
    margin-bottom: 4px;
}

.prompt-expand-hint {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gallery-id {
    color: rgba(212, 165, 116, 0.9);
    font-family: 'Courier Prime', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 1px;
    opacity: 0.8;
}

.gallery-controls {
    text-align: center;
}

.see-more-btn {
    padding: 15px 30px;
    background: #f7f5f0;
    color: #2c2c2c;
    border: 2px solid #2c2c2c;
    font-family: 'Courier Prime', monospace;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
}

.see-more-btn::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 1px dashed #d4a574;
    pointer-events: none;
}

.see-more-btn:hover:not(:disabled) {
    background: #2c2c2c;
    color: #f7f5f0;
    transform: translate(-2px, -2px);
    box-shadow: 
        5px 5px 0 #d4a574,
        5px 5px 0 2px #2c2c2c;
}

.see-more-btn:active:not(:disabled) {
    transform: translate(-1px, -1px);
    box-shadow: 
        2px 2px 0 #d4a574,
        2px 2px 0 1px #2c2c2c;
}

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

.gallery-error {
    text-align: center;
    color: #6b6b6b;
    font-style: italic;
    padding: 40px;
    background: #fff;
    border: 3px solid #2c2c2c;
    margin-bottom: 40px;
}

.gallery-loading {
    text-align: center;
    color: #6b6b6b;
    font-style: italic;
    padding: 40px;
}

/* Mobile-friendly prompt modal styles */
.prompt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 10px;
    box-sizing: border-box;
}

.prompt-modal-content {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #333;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.prompt-modal-header {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 20px 10px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: flex-end;
    z-index: 1001;
}

.prompt-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

.prompt-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.prompt-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.prompt-modal-text {
    color: white;
    font-family: 'Courier Prime', monospace;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.see-more-link {
    display: inline-block;
    padding: 10px 16px;
    background-color: #f97316;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    margin-top: 20px;
    text-align: center;
    transition: background-color 0.2s ease;
}

.see-more-link:hover {
    background-color: #ea580c;
}

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

/* Design Modal Styles */
.design-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.design-modal-content {
    background: #1a1a1a;
    border-radius: 12px;
    max-width: 600px;
    max-height: 90vh;
    width: 100%;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.design-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: #ccc;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.design-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: scale(1.1);
}

.design-modal-header {
    padding: 25px 25px 15px 25px;
    border-bottom: 1px solid #333;
    text-align: left;
    position: relative;
}

.design-modal-title {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    padding-right: 40px;
}

.design-modal-id {
    display: none;
}

.design-modal-image-container {
    padding: 20px;
    /* Enhanced centering with multiple methods */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    min-height: 100px; /* Ensures container has height even if image fails to load */
}

.design-modal-image {
    max-width: 100%;
    max-height: 60vh;
    height: auto;
    width: auto; /* Ensure width is also auto for proper aspect ratio */
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
    /* Additional centering insurance */
    display: block;
    margin: 0 auto;
}

.design-modal-image:hover {
    transform: scale(1.02);
}

.design-modal-error {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-style: italic;
    font-size: 16px;
}

.design-modal-description {
    padding: 25px;
}

.design-modal-description h4 {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.design-modal-description p {
    color: #ccc;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    white-space: pre-line;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .design-modal {
        padding: 10px;
    }
    
    .design-modal-content {
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .design-modal-header {
        padding: 15px 15px 10px 15px;
        text-align: left;
    }
    
    .design-modal-title {
        font-size: 16px;
        padding-right: 40px;
        line-height: 1.2;
    }
    
    .design-modal-close {
        top: 10px;
        right: 10px;
        font-size: 22px;
        width: 32px;
        height: 32px;
    }
    
    .design-modal-image-container {
        padding: 10px;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
    
    .design-modal-image {
        max-height: 35vh;
        max-width: 95%;
        margin: 0 auto;
        display: block;
    }
    
    .design-modal-description {
        padding: 15px;
    }
    
    .design-modal-description h4 {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .design-modal-description p {
        font-size: 13px;
        line-height: 1.4;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .design-modal {
        padding: 5px;
    }
    
    .design-modal-content {
        max-height: 98vh;
        border-radius: 6px;
    }
    
    .design-modal-header {
        padding: 12px 12px 8px 12px;
    }
    
    .design-modal-title {
        font-size: 14px;
        padding-right: 35px;
    }
    
    .design-modal-close {
        top: 8px;
        right: 8px;
        font-size: 20px;
        width: 28px;
        height: 28px;
    }
    
    .design-modal-image-container {
        padding: 8px;
    }
    
    .design-modal-image {
        max-height: 30vh;
        max-width: 98%;
    }
    
    .design-modal-description {
        padding: 12px;
    }
    
    .design-modal-description h4 {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .design-modal-description p {
        font-size: 12px;
        line-height: 1.3;
    }
}

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

/* === Responsive Design === */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 20px;
    }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .gallery-overlay .gallery-new-title {
        font-size: 12px;
    }
    
    .gallery-overlay-text {
        font-size: 11px;
        padding: 6px 10px;
        letter-spacing: 1px;
    }
    
    .prompt-modal {
        padding: 5px;
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .prompt-modal-content {
        max-height: 95vh;
        min-height: 200px;
    }
    
    .prompt-modal-header {
        padding: 10px 15px 5px;
    }
    
    .prompt-modal-close {
        font-size: 24px;
        width: 36px;
        height: 36px;
    }
    
    .prompt-modal-body {
        padding: 15px;
    }
    
    .prompt-modal-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .gallery-overlay .gallery-new-title {
        font-size: 10px;
        margin-bottom: 8px;
    }
    
    .gallery-overlay-text {
        font-size: 9px;
        padding: 5px 8px;
        letter-spacing: 0.5px;
    }
    
    .prompt-modal {
        padding: 2px;
        padding-top: 10px;
    }
    
    .prompt-modal-content {
        max-height: 98vh;
        border-radius: 4px;
    }
    
    .prompt-modal-header {
        padding: 8px 12px 4px;
    }
    
    .prompt-modal-close {
        font-size: 20px;
        width: 32px;
        height: 32px;
    }
    
    .prompt-modal-body {
        padding: 15px;
    }
    
    .prompt-modal-text {
        font-size: 13px;
        line-height: 1.4;
    }
}

.live-status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #22c55e;
    color: white;
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.live-status-badge::before {
    content: '●';
    margin-right: 4px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .live-status-badge {
        font-size: 8px;
        padding: 3px 6px;
        top: 6px;
        right: 6px;
    }
}

.image-error-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f5f5f5;
    border: 1px dashed #ccc;
    border-radius: 4px;
}

.error-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.error-text {
    color: #666;
    font-size: 0.9rem;
}

/* === Status Controls === */
.status-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 4px;
}

.status-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    flex: 1 1 auto;
    min-width: fit-content;
}

.status-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #ccc;
}

.status-btn:disabled {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
    cursor: not-allowed;
}

.status-btn.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* === Status Badges === */
.live-status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #22c55e;
    color: white;
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: calc(100% - 16px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-status-badge::before {
    content: '●';
    margin-right: 4px;
    animation: pulse 2s infinite;
}

.draft-status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff9800;
    color: white;
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: calc(100% - 16px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* === Etsy Buy Button Styles === */
.etsy-buy-section {
    padding: 4px;
    text-align: center;
    background: #fffcf9;
    border-top: 1px solid #eee;
    margin-top: 8px;
    width: 100%;
    box-sizing: border-box;
}

.etsy-buy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 60px;
    background: #f16521;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    width: 100%;
    max-width: 280px;
    height: 32px;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.etsy-buy-btn:hover {
    background: #23d41a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(241, 101, 33, 0.3);
    color: white;
}

.etsy-buy-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(241, 101, 33, 0.3);
}

.etsy-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Mobile responsive - stacked layout */
@media (max-width: 768px) {
    .status-controls {
        flex-direction: column;
        gap: 6px;
    }
    
    .status-btn {
        width: 100%;
        text-align: center;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .live-status-badge,
    .draft-status-badge {
        top: 6px;
        right: 6px;
        font-size: 9px;
        padding: 3px 6px;
    }
    
    .etsy-buy-btn {
        padding: 3px 40px;
        font-size: 13px;
        gap: 6px;
        max-width: 100%;
        width: calc(100% - 8px);
        height: 30px;
    }
    
    .etsy-icon {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .status-controls {
        padding: 8px;
        gap: 4px;
    }
    
    .status-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .live-status-badge,
    .draft-status-badge {
        top: 4px;
        right: 4px;
        font-size: 8px;
        padding: 2px 4px;
        border-radius: 8px;
    }
    
    .etsy-buy-btn {
        padding: 3px 20px;
        font-size: 12px;
        gap: 4px;
        height: 28px;
    }
    
    .etsy-icon {
        width: 12px;
        height: 12px;
    }
}

/* Extra small screens */
@media (max-width: 320px) {
    .etsy-buy-btn {
        padding: 2px 16px;
        font-size: 11px;
        gap: 3px;
        height: 26px;
    }
    
    .status-btn {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .live-status-badge,
    .draft-status-badge {
        font-size: 7px;
        padding: 2px 3px;
    }
}