/**
 * Custom CSS Additions
 *
 * @package Vendor_Theme
 */

/* ========================================
   Logo Styles
   ======================================== */

/* Custom Logo Link Wrapper */
.site-logo .custom-logo-link {
    display: flex;
    align-items: center;
}

/* Custom Logo Image */
.site-logo .custom-logo-link img,
.custom-logo-link img,
a.custom-logo-link img {
    max-width: 300px;
    max-height: 70px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Header adjustments when using custom logo */
.site-logo:has(.custom-logo-link) {
    font-size: inherit;
}

/* Logo responsive - Tablet */
@media (max-width: 992px) {
    .site-logo .custom-logo-link img,
    .custom-logo-link img,
    a.custom-logo-link img {
        max-width: 150px;
        max-height: 60px;
    }
}

/* Logo responsive - Mobile */
@media (max-width: 768px) {
    .site-logo .custom-logo-link img,
    .custom-logo-link img,
    a.custom-logo-link img {
        max-width: 130px;
        max-height: 50px;
    }
}

/* Logo responsive - Small Mobile */
@media (max-width: 480px) {
    .site-logo .custom-logo-link img,
    .custom-logo-link img,
    a.custom-logo-link img {
        max-width: 110px;
        max-height: 45px;
    }
}

/* ========================================
   Global Loader Styles
   ======================================== */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.global-loader.active {
    display: flex;
}

.loader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.loader-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 60px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.loader-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid transparent;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--accent, #e94560);
    animation-delay: -0.45s;
}

.spinner-ring:nth-child(2) {
    border-top-color: var(--primary, #1a1a2e);
    animation-delay: -0.3s;
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
}

.spinner-ring:nth-child(3) {
    border-top-color: var(--gold, #f4c430);
    animation-delay: -0.15s;
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-600, #666);
}

/* Loader for specific contexts */
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loading.btn-outline-primary::after,
.btn-loading.btn-secondary::after {
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-top-color: var(--primary, #1a1a2e);
}

/* Image upload progress */
.upload-progress-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

.upload-progress-bar {
    width: 80%;
    max-width: 200px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent, #e94560), var(--gold, #f4c430));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.upload-progress-text {
    font-size: 0.85rem;
    color: var(--gray-600, #666);
}

/* Inline loader for cards/sections */
.section-loading {
    position: relative;
    min-height: 100px;
}

.section-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f0f0f0;
    border-top-color: var(--accent, #e94560);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Skeleton loading for content */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 24px;
    width: 70%;
    margin-bottom: 15px;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 4/3;
}

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

/* Video Modal Styles */
.video-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.video-modal {
    position: relative;
    width: 100%;
    max-width: 900px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.video-modal iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
}

.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 5px 15px;
    transition: opacity 0.3s;
}

.video-modal-close:hover {
    opacity: 0.7;
}

/* Photo Item Hover */
.photo-item img {
    transition: transform 0.3s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn.loading {
    position: relative;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Form Validation Styles */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #e94560;
}

.form-error {
    color: #e94560;
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary);
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #e94560;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* Mobile Navigation */
@media (max-width: 768px) {
    #main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        padding: 20px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    }

    #main-nav ul {
        flex-direction: column;
        gap: 0;
    }

    #main-nav li {
        border-bottom: 1px solid #eee;
    }

    #main-nav a {
        display: block;
        padding: 15px 0;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .enquiry-btn,
    .vendor-sidebar,
    .modal-overlay {
        display: none !important;
    }

    .vendor-main {
        grid-template-columns: 1fr !important;
    }

    .vendor-hero {
        height: auto !important;
        min-height: auto !important;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus States */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary: #000;
        --accent: #0066cc;
    }

    .btn-primary {
        background: #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode */
    /*
    :root {
        --light: #1a1a2e;
        --white: #16213e;
        --gray-100: #1e1e3f;
        --gray-200: #2a2a4a;
        --gray-700: #e0e0e0;
        --primary: #f0f0f0;
    }

    body {
        background: var(--light);
        color: var(--gray-700);
    }

    .vendor-card,
    .sidebar-card,
    .vendor-about,
    .search-box {
        background: var(--white);
    }
    */
}

/* ========================================
   PWA - Progressive Web App Styles
   ======================================== */

/* Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: -120px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 15px 20px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
}

.pwa-install-banner.show {
    bottom: 0;
}

/* On vendor dashboard with bottom nav, position above it */
.vendor-dashboard .pwa-install-banner.show {
    bottom: 70px;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.pwa-banner-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pwa-banner-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-banner-text {
    flex: 1;
}

.pwa-banner-text strong {
    display: block;
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 2px;
}

.pwa-banner-text span {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pwa-install-btn {
    background: var(--accent, #e94560);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 44px;
}

.pwa-install-btn:hover,
.pwa-install-btn:active {
    background: #d63850;
    transform: scale(1.02);
}

.pwa-dismiss-btn {
    background: #f0f0f0;
    border: none;
    font-size: 1.2rem;
    color: var(--gray-500, #666);
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
    border-radius: 50%;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.pwa-dismiss-btn:hover,
.pwa-dismiss-btn:active {
    background: #e0e0e0;
    color: var(--gray-700, #333);
}

/* Update Notification */
.pwa-update-notification {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), #16213e);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-update-notification.show {
    top: 20px;
}

.pwa-update-notification span {
    font-size: 0.9rem;
}

.pwa-update-notification button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* PWA Instructions Modal */
.pwa-instructions {
    text-align: left;
}

.pwa-instructions h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary);
}

.pwa-instructions ol {
    padding-left: 20px;
    margin-bottom: 25px;
}

.pwa-instructions li {
    padding: 10px 0;
    color: var(--gray-600);
    line-height: 1.6;
}

.pwa-instructions .btn {
    width: 100%;
}

/* Standalone Mode Adjustments */
.pwa-standalone .site-header {
    padding-top: env(safe-area-inset-top);
}

.pwa-standalone .mobile-action-bar {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

/* iOS Splash Screen Style */
@media (display-mode: standalone) {
    body {
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        overscroll-behavior-y: contain;
    }
    
    /* Prevent pull-to-refresh */
    html, body {
        overscroll-behavior: none;
    }
}

/* Mobile PWA Banner */
@media (max-width: 480px) {
    .pwa-banner-content {
        gap: 12px;
    }
    
    .pwa-banner-icon {
        width: 45px;
        height: 45px;
    }
    
    .pwa-banner-text strong {
        font-size: 0.95rem;
    }
    
    .pwa-banner-text span {
        font-size: 0.8rem;
    }
    
    .pwa-install-btn {
        padding: 8px 18px;
        font-size: 0.85rem;
    }
}
