/**
 * ZooSpace Poster Generator - Frontend Styles
 */

/* ==========================================================================
   Modal Base Styles
   ========================================================================== */

.zoospace-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoospace-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.zoospace-modal-container {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: zoospace-modal-appear 0.3s ease-out;
}

@keyframes zoospace-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

body.zoospace-modal-open {
    overflow: hidden;
    /* Styles се управляват от JavaScript за по-добър контрол */
}

/* ==========================================================================
   Modal Header
   ========================================================================== */

.zoospace-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.zoospace-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.zoospace-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.zoospace-modal-close:hover {
    background: #e5e7eb;
    color: #111827;
}

/* ==========================================================================
   Modal Body
   ========================================================================== */

.zoospace-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ==========================================================================
   Image Selector
   ========================================================================== */

.zoospace-image-selector {
    margin-bottom: 20px;
    padding: 15px;
    background: #f3f4f6;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.zoospace-image-selector-label {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.zoospace-image-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.zoospace-image-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.zoospace-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.zoospace-image-thumb:hover {
    border-color: #60a5fa;
    transform: scale(1.05);
}

.zoospace-image-thumb.selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.zoospace-thumb-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.zoospace-image-thumb.selected .zoospace-thumb-check {
    display: flex;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.zoospace-loading {
    text-align: center;
    padding: 40px 20px;
}

.zoospace-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: zoospace-spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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

.zoospace-loading p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* ==========================================================================
   Poster Preview - Responsive Optimization
   ========================================================================== */

.zoospace-poster-preview {
    min-height: 200px;
    overflow: hidden;
    position: relative;
}

.zoospace-poster-content {
    transition: opacity 0.2s;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
}

/* Ensure poster elements stay within bounds */
.zoospace-poster-content .poster,
.zoospace-poster-content .zoospace-poster {
    overflow: hidden !important;
}

.zoospace-poster-content .poster .inner,
.zoospace-poster-content .zoospace-poster .inner {
    overflow: hidden !important;
}

/* Fix footer elements positioning in preview */
.zoospace-poster-content .poster .footer,
.zoospace-poster-content .zoospace-poster .footer,
.zoospace-poster-content .poster .poster-footer,
.zoospace-poster-content .zoospace-poster .poster-footer {
    overflow: hidden !important;
    position: relative !important;
}

/* Constrain logo and QR code within footer */
.zoospace-poster-content .footer-logo,
.zoospace-poster-content .poster-logo img {
    max-width: 45mm !important;
    height: auto !important;
}

.zoospace-poster-content .footer-qr,
.zoospace-poster-content .poster-qr {
    max-width: 20mm !important;
    max-height: 20mm !important;
}

.zoospace-poster-content .footer-qr img,
.zoospace-poster-content .poster-qr img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

/* Wrapper за controlled scrolling */
.zoospace-poster-wrapper {
    overflow: auto;
    max-height: calc(100vh - 250px);
    width: 100%;
    display: flex;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

/* Base poster scaling - ONLY inside modal */
#zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
#zoospace-poster-modal .zoospace-poster-content .poster {
    transform-origin: top center;
    /* Default scale for large screens */
    transform: scale(0.7);
    margin-bottom: calc(-297mm * 0.3);
    /* Smooth transitions */
    transition: transform 0.2s ease, margin-bottom 0.2s ease;
}

/* ==========================================================================
   Error State
   ========================================================================== */

.zoospace-error {
    text-align: center;
    padding: 30px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
}

.zoospace-error p {
    margin: 0;
}

/* ==========================================================================
   Modal Footer
   ========================================================================== */

.zoospace-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.zoospace-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.zoospace-btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.zoospace-btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.zoospace-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.zoospace-btn-primary.loading {
    pointer-events: none;
}

.zoospace-btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.zoospace-btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.zoospace-btn-icon {
    font-size: 16px;
}

/* ==========================================================================
   Preview Button (on listing page)
   ========================================================================== */

.zoospace-preview-poster-btn,
.zoospace-poster-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.zoospace-preview-poster-btn:hover,
.zoospace-poster-preview-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

/* ==========================================================================
   Responsive - Enhanced for All Devices
   ========================================================================== */

/* Large Desktop (≥1200px) */
@media (min-width: 1200px) {
    .zoospace-modal-container {
        max-width: 900px;
        max-height: 90vh;
    }
    
    #zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
    #zoospace-poster-modal .zoospace-poster-content .poster {
        transform: scale(0.7);
        margin-bottom: calc(-297mm * 0.3);
    }
}

/* Desktop (992-1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .zoospace-modal-container {
        max-width: 850px;
        max-height: 92vh;
    }
    
    #zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
    #zoospace-poster-modal .zoospace-poster-content .poster {
        transform: scale(0.6);
        margin-bottom: calc(-297mm * 0.4);
    }
}

/* Tablet (768-991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .zoospace-modal-container {
        max-width: 95%;
        max-height: 95vh;
    }
    
    .zoospace-modal-body {
        padding: 15px;
    }
    
    #zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
    #zoospace-poster-modal .zoospace-poster-content .poster {
        transform: scale(0.5);
        margin-bottom: calc(-297mm * 0.5);
    }
}

/* Large Phone (576-767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .zoospace-modal-container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .zoospace-modal-header {
        padding: 14px 18px;
    }
    
    .zoospace-modal-body {
        padding: 12px;
    }
    
    .zoospace-image-thumb {
        width: 70px;
        height: 70px;
    }
    
    #zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
    #zoospace-poster-modal .zoospace-poster-content .poster {
        transform: scale(0.45);
        margin-bottom: calc(-297mm * 0.55);
    }
    
    .zoospace-modal-footer {
        padding: 14px 18px;
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
        align-items: stretch !important;
    }
    
    .zoospace-modal-footer .zoospace-btn {
        width: 100% !important;
        padding: 14px 20px;
        font-size: 15px;
        margin: 0 !important;
    }
}

/* Small Phone (<576px) */
@media (max-width: 575px) {
    .zoospace-modal-container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .zoospace-modal-header {
        padding: 12px 15px;
    }
    
    .zoospace-modal-title {
        font-size: 16px;
    }
    
    .zoospace-modal-close {
        width: 32px;
        height: 32px;
        font-size: 24px;
    }
    
    .zoospace-modal-body {
        padding: 10px;
        flex: 1;
        overflow-y: auto;
    }
    
    .zoospace-image-selector {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .zoospace-image-selector-label {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .zoospace-image-thumbs {
        gap: 8px;
        justify-content: center;
    }
    
    .zoospace-image-thumb {
        width: 55px;
        height: 55px;
        border-width: 2px;
    }
    
    .zoospace-thumb-check {
        width: 18px;
        height: 18px;
        font-size: 10px;
        top: 2px;
        right: 2px;
    }
    
    #zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
    #zoospace-poster-modal .zoospace-poster-content .poster {
        transform: scale(0.35);
        margin-bottom: calc(-297mm * 0.65);
    }
    
    .zoospace-modal-footer {
        padding: 12px 15px;
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    
    .zoospace-modal-footer .zoospace-btn {
        width: 100% !important;
        padding: 14px 20px;
        font-size: 15px;
        margin: 0 !important;
    }
}

/* Very Small Phone (<400px) */
@media (max-width: 399px) {
    .zoospace-image-thumb {
        width: 48px;
        height: 48px;
    }
    
    #zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
    #zoospace-poster-modal .zoospace-poster-content .poster {
        transform: scale(0.3);
        margin-bottom: calc(-297mm * 0.7);
    }
}

/* ==========================================================================
   ENHANCED MOBILE OPTIMIZATIONS v2.0
   ========================================================================== */

/* Small Phone - Enhanced (<576px) */
@media (max-width: 575px) {
    /* Image selector - horizontal scroll */
    .zoospace-image-selector {
        padding: 12px;
        margin: -10px -10px 15px -10px;
        border-radius: 0;
        background: linear-gradient(180deg, #f8f9fa 0%, #f3f4f6 100%);
        border-bottom: 1px solid #e5e7eb;
    }
    
    .zoospace-image-thumbs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        padding: 5px 2px 12px 2px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .zoospace-image-thumbs::-webkit-scrollbar {
        height: 4px;
    }
    
    .zoospace-image-thumbs::-webkit-scrollbar-track {
        background: #e5e7eb;
        border-radius: 2px;
    }
    
    .zoospace-image-thumbs::-webkit-scrollbar-thumb {
        background: #9ca3af;
        border-radius: 2px;
    }
    
    .zoospace-image-thumb {
        flex: 0 0 auto;
        width: 68px;
        height: 68px;
        scroll-snap-align: start;
    }
    
    /* Fixed footer at bottom */
    .zoospace-modal-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 15px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        background: #fff;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        z-index: 100;
        border-radius: 0;
        border-top: 1px solid #e5e7eb;
    }
    
    /* Adjust body for fixed footer */
    .zoospace-modal-body {
        padding-bottom: 130px;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    /* Poster preview area styling */
    .zoospace-poster-preview {
        background: linear-gradient(145deg, #e8e8e8, #f2f2f2);
        border-radius: 12px;
        padding: 15px 10px;
        min-height: 45vh;
        position: relative;
    }
    
    /* Scroll hint for poster */
    .zoospace-poster-preview::before {
        content: '↕ Скролирайте за целия плакат';
        display: block;
        text-align: center;
        font-size: 11px;
        color: #888;
        padding: 0 0 10px 0;
        opacity: 0.9;
    }
    
    /* Better button styling on mobile */
    .zoospace-modal-footer .zoospace-btn {
        padding: 14px 16px;
        font-size: 14px;
        border-radius: 10px;
    }
    
    .zoospace-modal-footer .zoospace-btn-primary {
        font-weight: 600;
    }
    
    /* Stack buttons vertically - enforced with !important */
    .zoospace-modal-footer {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    
    .zoospace-modal-footer .zoospace-btn {
        width: 100% !important;
        justify-content: center;
        margin: 0 !important;
    }
    
    /* Hide secondary close button on mobile - X is enough */
    .zoospace-modal-footer .zoospace-btn-secondary.zoospace-modal-close-btn {
        display: none;
    }
}

/* Very Small Phone - Enhanced (<400px) */
@media (max-width: 399px) {
    .zoospace-modal-header {
        padding: 10px 12px;
    }
    
    .zoospace-modal-title {
        font-size: 14px;
    }
    
    .zoospace-modal-close {
        width: 36px;
        height: 36px;
        font-size: 26px;
    }
    
    .zoospace-image-selector {
        padding: 10px;
    }
    
    .zoospace-image-thumb {
        width: 58px;
        height: 58px;
    }
    
    .zoospace-modal-footer {
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    
    .zoospace-modal-footer .zoospace-btn {
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .zoospace-poster-preview::before {
        font-size: 10px;
    }
}

/* Pull-to-close indicator */
.zoospace-pull-indicator {
    display: none;
}

@media (max-width: 767px) {
    .zoospace-pull-indicator {
        display: block;
        width: 36px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
        margin: 0 auto 8px;
    }
}

/* Enhanced loading state with skeleton */
.zoospace-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    padding: 30px;
}

.zoospace-loading-skeleton {
    width: 100%;
    max-width: 180px;
    height: 250px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: zoospace-skeleton-loading 1.5s infinite;
    border-radius: 10px;
    margin-bottom: 15px;
}

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

/* iOS Safe Area support */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 575px) {
        .zoospace-modal-footer {
            padding-bottom: calc(12px + env(safe-area-inset-bottom));
        }
        
        .zoospace-modal-body {
            padding-bottom: calc(130px + env(safe-area-inset-bottom));
        }
    }
}

/* Notch support for landscape */
@supports (padding: env(safe-area-inset-left)) {
    @media (max-width: 900px) and (orientation: landscape) {
        .zoospace-modal-container {
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
        }
    }
}

/* ==========================================================================
   Landscape Mode Optimizations
   ========================================================================== */

/* Mobile Landscape */
@media (max-width: 900px) and (orientation: landscape) {
    .zoospace-modal-container {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 100vh;
    }
    
    .zoospace-modal-header {
        width: 100%;
        padding: 10px 15px;
    }
    
    .zoospace-modal-body {
        flex: 1;
        width: 70%;
        padding: 10px;
        overflow-y: auto;
    }
    
    .zoospace-image-selector {
        display: none; /* Hide on landscape mobile for more space */
    }
    
    #zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
    #zoospace-poster-modal .zoospace-poster-content .poster {
        transform: scale(0.4);
        margin-bottom: calc(-297mm * 0.6);
    }
    
    .zoospace-modal-footer {
        flex-direction: column;
        width: 30%;
        min-width: 140px;
        border-top: none;
        border-left: 1px solid #e5e7eb;
        padding: 15px;
        justify-content: center;
    }
    
    .zoospace-modal-footer .zoospace-btn {
        width: 100%;
        padding: 12px 15px;
        font-size: 13px;
    }
}

/* Tablet Landscape */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .zoospace-modal-container {
        max-width: 90vw;
        max-height: 90vh;
    }
    
    #zoospace-poster-modal .zoospace-poster-content .zoospace-poster,
    #zoospace-poster-modal .zoospace-poster-content .poster {
        transform: scale(0.55);
        margin-bottom: calc(-297mm * 0.45);
    }
}

/* ==========================================================================
   Touch-Friendly Optimizations
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .zoospace-modal-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    .zoospace-image-thumb {
        min-width: 50px;
        min-height: 50px;
    }
    
    .zoospace-btn {
        min-height: 44px;
    }
    
    /* Smooth scrolling */
    .zoospace-poster-wrapper,
    .zoospace-modal-body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Remove hover effects that don't work on touch */
    .zoospace-image-thumb:hover {
        transform: none;
    }
    
    .zoospace-btn-primary:hover,
    .zoospace-btn-secondary:hover {
        transform: none;
    }
    
    /* Active states instead */
    .zoospace-image-thumb:active {
        transform: scale(0.95);
    }
    
    .zoospace-btn:active {
        transform: scale(0.98);
    }
}

/* ==========================================================================
   Preview Mode Layout Fixes - Flexbox Override
   ========================================================================== */

/* Override fixed heights in preview mode - Force flexbox layout */
.zoospace-poster-preview .poster .inner,
.zoospace-poster-content .poster .inner,
#zoospace-poster-modal .poster .inner {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* Header - auto height with min constraint */
.zoospace-poster-preview .poster .header,
.zoospace-poster-content .poster .header,
#zoospace-poster-modal .poster .header {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 14mm !important;
    line-height: 1.3 !important;
    padding: 4mm 5mm !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Photo - flexible height with constraints */
.zoospace-poster-preview .poster .photo,
.zoospace-poster-content .poster .photo,
#zoospace-poster-modal .poster .photo {
    flex: 0 1 auto !important;
    height: auto !important;
    min-height: 80mm !important;
    max-height: 150mm !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.zoospace-poster-preview .poster .photo img,
.zoospace-poster-content .poster .photo img,
#zoospace-poster-modal .poster .photo img {
    max-height: 140mm !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

/* Content - compact, no extra space */
.zoospace-poster-preview .poster .content,
.zoospace-poster-content .poster .content,
#zoospace-poster-modal .poster .content {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    padding: 3mm 5mm 2mm 5mm !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Motivation - compact */
.zoospace-poster-preview .poster .motivation,
.zoospace-poster-content .poster .motivation,
#zoospace-poster-modal .poster .motivation {
    font-size: 11pt !important;
    margin-bottom: 2mm !important;
    margin-top: 1mm !important;
    line-height: 1.25 !important;
}

/* CTA - compact */
.zoospace-poster-preview .poster .cta,
.zoospace-poster-content .poster .cta,
#zoospace-poster-modal .poster .cta {
    font-size: 10pt !important;
    margin-bottom: 2mm !important;
    line-height: 1.3 !important;
}

/* CTA highlight - smaller padding */
.zoospace-poster-preview .poster .cta-highlight,
.zoospace-poster-content .poster .cta-highlight,
#zoospace-poster-modal .poster .cta-highlight {
    padding: 0.5mm 2mm !important;
    font-size: 10pt !important;
}

/* Dividers - thinner margins */
.zoospace-poster-preview .poster .divider,
.zoospace-poster-content .poster .divider,
#zoospace-poster-modal .poster .divider {
    margin: 2mm 0 !important;
}

/* Status title - smaller */
.zoospace-poster-preview .poster .status,
.zoospace-poster-content .poster .status,
#zoospace-poster-modal .poster .status {
    font-size: 12pt !important;
    margin: 2mm 0 !important;
}

/* Fields container - compact, no flex grow */
.zoospace-poster-preview .poster .fields-container,
.zoospace-poster-content .poster .fields-container,
#zoospace-poster-modal .poster .fields-container {
    margin-bottom: 2mm !important;
    flex: 0 0 auto !important;
}

/* Field rows - compact with smaller font */
.zoospace-poster-preview .poster .field-row,
.zoospace-poster-content .poster .field-row,
#zoospace-poster-modal .poster .field-row {
    padding: 1.5mm 0 !important;
    font-size: 9pt !important;
    gap: 1mm !important;
}

/* Field icons - smaller */
.zoospace-poster-preview .poster .field-icon,
.zoospace-poster-content .poster .field-icon,
#zoospace-poster-modal .poster .field-icon {
    font-size: 11pt !important;
}

/* Footer - relative positioning, pushed to bottom */
.zoospace-poster-preview .poster .footer,
.zoospace-poster-content .poster .footer,
#zoospace-poster-modal .poster .footer {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 16mm !important;
    margin: 0 4mm 3mm 4mm !important;
    padding-top: 2mm !important;
}

/* Footer logo - smaller */
.zoospace-poster-preview .poster .footer-logo,
.zoospace-poster-content .poster .footer-logo,
#zoospace-poster-modal .poster .footer-logo {
    max-width: 35mm !important;
    max-height: 12mm !important;
}

/* Footer text - smaller */
.zoospace-poster-preview .poster .footer-text .thanks,
.zoospace-poster-content .poster .footer-text .thanks,
#zoospace-poster-modal .poster .footer-text .thanks {
    font-size: 9pt !important;
}

.zoospace-poster-preview .poster .footer-text .share,
.zoospace-poster-content .poster .footer-text .share,
#zoospace-poster-modal .poster .footer-text .share {
    font-size: 8pt !important;
}

/* Footer QR - smaller */
.zoospace-poster-preview .poster .footer-qr,
.zoospace-poster-content .poster .footer-qr,
#zoospace-poster-modal .poster .footer-qr {
    width: 12mm !important;
    height: 12mm !important;
    max-width: 12mm !important;
    max-height: 12mm !important;
}

/* ==========================================================================
   Print Styles - Ensure A4 Quality
   ========================================================================== */

@media print {
    .zoospace-modal {
        position: absolute;
        background: none;
    }
    
    .zoospace-modal-overlay {
        display: none;
    }
    
    .zoospace-modal-container {
        width: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }
    
    .zoospace-modal-header,
    .zoospace-modal-footer,
    .zoospace-image-selector {
        display: none !important;
    }
    
    .zoospace-modal-body {
        padding: 0;
        overflow: visible;
    }
    
    .zoospace-poster-content .zoospace-poster,
    .zoospace-poster-content .poster {
        transform: none !important;
        margin-bottom: 0 !important;
    }
    
    /* Ensure colors print correctly */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ==========================================================================
   Sidebar Widget Styles (Petslist Theme Compatible)
   ========================================================================== */

/* Widget wrapper - matches theme's rtcl-listing-user-info style */
.zoospace-poster-sidebar-widget {
    margin-top: 25px;
}

.zoospace-poster-sidebar-widget .list-group {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Title - matches theme's rtcl-listing-side-title style */
.zoospace-poster-sidebar-widget .rtcl-listing-side-title {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.zoospace-poster-sidebar-widget .rtcl-listing-side-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #000;
    display: flex;
    align-items: center;
}

.zoospace-poster-sidebar-widget .rtcl-listing-side-title h3 i {
    color: var(--petslist-primary-color, #10b981);
}

/* Widget content */
.zoospace-poster-sidebar-widget .poster-widget-content {
    padding: 20px 25px;
}

/* Action Buttons - matches theme's item-number style */
.poster-widget-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.poster-widget-actions .item-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    font-size: 15px;
    font-weight: 500;
}

.poster-widget-actions .item-number .number-icon {
    display: flex;
    align-items: center;
    gap: 10px;
}

.poster-widget-actions .item-number .number-icon i {
    font-size: 18px;
}

/* Preview button - primary color */
.poster-widget-actions .zoospace-preview-poster-btn {
    background: var(--petslist-primary-color, #10b981);
    color: #fff;
}

.poster-widget-actions .zoospace-preview-poster-btn:hover {
    background: var(--petslist-secondary-color, #059669);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* Notice */
.poster-widget-notice {
    background: #fef3c7;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #fcd34d;
}

.poster-widget-notice p {
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #92400e;
    line-height: 1.5;
}

.poster-widget-notice i {
    color: #d97706;
    flex-shrink: 0;
    font-size: 18px;
    margin-top: 2px;
}

/* Status messages in widget */
.zoospace-poster-sidebar-widget .zoospace-poster-status {
    margin-top: 15px;
    font-size: 13px;
    text-align: center;
}

/* Responsive */
@media (max-width: 991px) {
    .zoospace-poster-sidebar-widget {
        margin-top: 30px;
    }
}

@media (max-width: 767px) {
    .zoospace-poster-sidebar-widget .poster-widget-content {
        padding: 15px 20px;
    }
    
    /* Buttons stacked vertically like desktop */
    .poster-widget-actions {
        flex-direction: column;
    }
    
    .poster-widget-actions .item-number {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .poster-widget-actions .item-number .number-icon i {
        font-size: 18px;
    }
}
