/* ===================================
   LOADING STATES & REUSABLE UTILS
   =================================== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin-simple 0.8s linear infinite;
}

@keyframes spin-simple {
    to { transform: rotate(360deg); }
}

.form-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ===================================
   PERFORMANCE & IMAGE OPTIMIZATIONS
   =================================== */
.feature-card,
.brand-card,
.stat-card,
.value-card,
.solution-panel {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

img {
    image-rendering: -webkit-optimize-contrast;
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    .header, .scroll-progress, .scroll-top, .mobile-menu, .menu-toggle, .catalog-modal {
        display: none !important;
    }
    body { background: white; color: black; }
    .hero-bg, .contact-bg, .footer-bg { background: none; }
}

/* ===================================
   CATALOG MODAL (FLIPBOOK) - BASE
   =================================== */
.catalog-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 3vw, 40px);
}

.catalog-modal.active {
    display: flex;
}

.catalog-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
}

.catalog-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    height: 90dvh; /* Dynamic viewport height for mobile */
    background: white;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    z-index: 10;
    transform: translateY(30px) scale(0.98);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.catalog-modal.active .catalog-modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Header */
.catalog-modal-header {
    padding: clamp(12px, 2vw, 20px) clamp(16px, 3vw, 32px);
    background: white;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.catalog-info {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 16px);
    min-width: 0; /* Prevents overflow with long titles */
}

.catalog-info i {
    color: var(--primary-orange);
    width: clamp(20px, 2.5vw, 28px);
    height: clamp(20px, 2.5vw, 28px);
    flex-shrink: 0;
}

.catalog-info h3 {
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-close {
    width: clamp(36px, 4vw, 48px);
    height: clamp(36px, 4vw, 48px);
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.catalog-close:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

/* Viewer Container */
.catalog-viewer-container {
    flex: 1;
    background: var(--gray-100);
    position: relative;
    overflow: hidden;
}

.catalog-viewer-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Loader */
.catalog-loader {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 5;
}

.loader-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--gray-100);
    border-top-color: var(--primary-orange);
    border-radius: 50%;
    animation: spin-heavy 1s linear infinite;
}

@keyframes spin-heavy {
    to { transform: rotate(360deg); }
}

/* Footer */
.catalog-modal-footer {
    padding: clamp(12px, 1.5vw, 16px) clamp(16px, 3vw, 32px);
    background: white;
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-shrink: 0;
}

.catalog-modal-footer p {
    font-size: clamp(12px, 1.25vw, 14px);
    color: var(--gray-500);
    display: none; /* Hide on small screens, show on larger */
}

.catalog-download-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: clamp(10px, 1.25vw, 14px) clamp(16px, 2vw, 24px);
    background: linear-gradient(135deg, var(--primary-orange), var(--primary-yellow));
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: clamp(14px, 1.25vw, 16px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.catalog-download-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(217, 119, 6, 0.4);
    filter: brightness(1.1);
}

/* ===================================
   RESPONSIVE OVERRIDES
   =================================== */

/* Tablets & Desktop Small (Up to 1024px) */
@media (max-width: 1024px) {
    .catalog-modal-content {
        max-width: 95%;
        height: 85vh;
    }
}

/* Mobile Devices (Up to 768px) */
@media (max-width: 768px) {
    .catalog-modal {
        padding: 0;
    }

    .catalog-modal-content {
        height: 100%;
        height: 100dvh;
        border-radius: 0;
    }

    .catalog-modal-header {
        padding: 12px 16px;
    }

    .catalog-modal-footer {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }

    .catalog-download-link {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }
}

/* Small Mobile Devices (iPhone SE / 320px - 375px) */
@media (max-width: 375px) {
    .catalog-info h3 {
        font-size: 14px;
    }

    .catalog-close {
        width: 32px;
        height: 32px;
    }
}

/* Landscape orientation on mobile (Short screens) */
@media (max-height: 500px) and (orientation: landscape) {
    .catalog-modal-header {
        padding: 8px 16px;
    }
    
    .catalog-modal-footer {
        padding: 8px 16px;
    }

    .catalog-modal-footer p {
        display: none;
    }
}

/* Ultra Wide Screens */
@media (min-width: 1800px) {
    .catalog-modal-content {
        max-width: 1400px;
        height: 80vh;
    }
}

/* Showing footer text on larger mobile/tablets */
@media (min-width: 480px) {
    .catalog-modal-footer p {
        display: block;
    }
}
