/* Common/Reusable Styles for Al Meera Qatar */

/* CSS Variables */
:root {
    --gradient-primary: linear-gradient(135deg, #019900 0%, #0d7c0d 50%, #0a5c0a 100%);
    --gradient-secondary: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-glass: 0 8px 32px rgba(31, 38, 135, 0.37);
    --backdrop-blur: blur(20px);
    --primary: #019900;
    --gray-200: #e5e7eb;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --radius-lg: 0.5rem;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
    --font-bold: 700;
    --tracking-wide: 0.025em;
    --white: #ffffff;
}

/* Global Styles */
body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 20%, #f1f5f9 40%, #ffffff 60%, #f8fafc 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

html {
    scroll-behavior: smooth;
}

main {
    animation: pageEnter 0.8s ease-out;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header Styles */
header {
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
    position: static;
    z-index: auto;
}

/* Text Styles */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: var(--font-bold);
}

/* Button Styles */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    box-shadow: 
        0 8px 20px rgba(1, 153, 0, 0.3),
        0 3px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 30px rgba(1, 153, 0, 0.4),
        0 5px 10px rgba(0, 0, 0, 0.15);
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Flyer Container Styles */
.flyer-container {
    background: transparent;
    border: none;
    box-shadow: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    padding: 0;
    margin: 0;
}

#iframeContainer {
    margin: 0;
    padding: 0;
    line-height: 0;
}

.a4-container {
    padding-top: 60px;
    width: 100%;
    max-width: 70vw;
    margin: 0 auto;
    position: relative;
    min-height: 600px;
    height: 650px;
    max-height: 85vh;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.a4-container iframe,
.a4-container img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    border-radius: 8px;
    border: none;
    display: block;
    position: static;
}

.flyer-iframe {
    width: 100% !important;
    height: 1150px !important;
    min-height: 200px !important;
    max-height: 1250px !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    overflow: hidden !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    transform-origin: center center;
    /* Enable touch events for mobile swiping */
    touch-action: auto !important;
    pointer-events: auto !important;
    /* Ensure proper flipsnack initialization */
    border-radius: 0 !important;
}

.a4-container::after {
    content: '';
    display: block;
    height: 50px;
    width: 100%;
    position: absolute;
    bottom: -50px;
    left: 0;
    pointer-events: none;
}

/* Flipsnack Navigation Override */
.flipsnack-navigation,
.flipsnack-controls,
[class*="flipsnack-nav"],
[class*="flipsnack-control"],
[class*="navigation"],
[class*="toolbar"],
[class*="download"],
[class*="save"],
[class*="share"],
[class*="fullscreen"] {
    visibility: visible !important;
    display: block !important;
    opacity: 1 !important;
    z-index: 999 !important;
    position: relative !important;
    pointer-events: auto !important;
    user-select: auto !important;
}

/* Minimal Flyer Tab Navigation */
.flyer-tab {
    position: relative;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 8px;
    outline: none;
}

.flyer-tab .thumbnail-preview {
    width: 90px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.flyer-tab.active .thumbnail-preview {
    border: 2px solid #019900;
    box-shadow: 0 4px 12px rgba(1, 153, 0, 0.15);
}

.flyer-tab:hover .thumbnail-preview {
    border-color: #019900;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.flyer-tab .thumbnail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.2s ease;
}

.flyer-tab .thumbnail-preview svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.flyer-tab:hover .thumbnail-preview img {
    transform: scale(1.02);
}

.flyer-tab:focus {
    outline: 2px solid #019900;
    outline-offset: 2px;
    border-radius: 8px;
}

#flyerTabs {
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 4px;
}

#flyerTabNavContainer {
    background: transparent;
    margin: 0 auto 20px auto;
    max-width: fit-content;
    display: block !important;
    visibility: visible !important;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .flyer-tab .thumbnail-preview {
        width: 80px;
        height: 110px;
    }
    
    #flyerTabs {
        padding: 8px 12px;
        gap: 2px;
    }
    
    .flyer-tab {
        margin: 6px;
    }
}

@media (max-width: 480px) {
    .flyer-tab .thumbnail-preview {
        width: 70px;
        height: 100px;
    }
    
    .flyer-tab {
        margin: 4px;
    }
    
    #flyerTabs {
        padding: 6px 8px;
    }
}

/* Thumbnail Preview */
#thumbnailPreview {
    transition: all 0.3s ease;
}

/* Floating Decorations */
.floating-decoration {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    animation: float 8s ease-in-out infinite;
}

.floating-decoration.delayed {
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) translateX(0px) rotate(0deg); 
        opacity: 0.6;
    }
    25% { 
        transform: translateY(-20px) translateX(10px) rotate(90deg); 
        opacity: 0.8;
    }
    50% { 
        transform: translateY(-10px) translateX(-15px) rotate(180deg); 
        opacity: 0.4;
    }
    75% { 
        transform: translateY(-30px) translateX(5px) rotate(270deg); 
        opacity: 0.7;
    }
}

/* Loading Spinner */
.loading-spinner {
    border: 4px solid rgba(1, 153, 0, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: var(--space-6) auto;
    box-shadow: 0 4px 15px rgba(1, 153, 0, 0.2);
}

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

/* Social Links */
.social-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-full);
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    background: var(--glass-bg);
    backdrop-filter: var(--backdrop-blur);
}

.social-link:hover {
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.15),
        0 5px 10px rgba(1, 153, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-3px) scale(1.05);
}


/* Notifications */
.notification {
    animation: slideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

@keyframes slideIn {
    0% {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
    60% {
        transform: translateX(-5px) scale(1.02);
        opacity: 0.8;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.notification:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 12px 28px rgba(0, 0, 0, 0.1);
}

/* Campaign Popup Styles */
.campaign-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.campaign-popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.campaign-popup-container {
    position: relative;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    transform: scale(0.8) translateY(50px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.campaign-popup-overlay.show .campaign-popup-container {
    transform: scale(1) translateY(0);
}

.campaign-popup-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 12px 28px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.campaign-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.3s ease;
    z-index: 10;
}

.campaign-popup-close:hover {
    background: rgba(0, 0, 0, 0.15);
    color: #374151;
    transform: scale(1.1);
}

.campaign-popup-image {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
}

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

.campaign-popup-header {
    padding: 32px 32px 16px 32px;
    text-align: center;
}

.campaign-popup-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--primary), #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.campaign-popup-body {
    padding: 16px 32px 32px 32px;
    text-align: center;
}

.campaign-popup-body p {
    font-size: 16px;
    line-height: 1.6;
    color: #4b5563;
    margin: 0 0 24px 0;
}

.campaign-popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.campaign-btn-primary {
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    background: linear-gradient(135deg, var(--primary), #059669);
    color: white;
    box-shadow: 0 8px 24px rgba(1, 153, 0, 0.3);
}

.campaign-btn-primary:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 32px rgba(1, 153, 0, 0.4);
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .campaign-popup-container {
        width: 95%;
        margin: 0 20px;
    }
    
    .campaign-popup-header {
        padding: 24px 20px 12px 20px;
    }
    
    .campaign-popup-header h2 {
        font-size: 24px;
    }
    
    .campaign-popup-body {
        padding: 12px 20px 24px 20px;
    }
    
    .campaign-btn-primary {
        width: 100%;
    }
}

/* Hero Section */
.hero-section {
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    display: none;
}

/* Force consistent flipbook behavior for all flyers */
.flyer-iframe {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .a4-container {
        max-width: 95vw;
        max-height: 85vh;
        border-radius: 8px;
        margin: 0 auto;
        /* Enable touch interactions on mobile */
        touch-action: manipulation;
        /* Reduce container padding */
        padding-top: 20px;
        /* Adjust aspect ratio for mobile */
        aspect-ratio: 16 / 9;
        min-height: 500px;
    }
    
    .flyer-iframe {
        height: 1000px !important;
        transform: translate(-50%, -50%) !important;
        /* Optimize for consistent mobile touch interactions */
        touch-action: pan-x pan-y !important;
        -webkit-overflow-scrolling: touch !important;
        overflow: hidden !important;
        /* Force flipbook mode on mobile */
        scrolling: no !important;
        /* Ensure consistent swiping behavior */
        -webkit-user-select: none !important;
        user-select: none !important;
        pointer-events: auto !important;
    }
    
    #flyerTabs {
        gap: 6px;
        padding: 8px;
    }
    
    main {
        padding: 8px;
    }
    
    /* Reduce footer spacing on mobile */
    footer .h-32 {
        height: 2rem !important;
    }
}

@media (max-width: 600px) {
  #flyerTabNavContainer {
    margin-bottom: 0px !important;
    padding-top: 0.5rem !important;
  }
  .flyer-iframe {
    height: 700px !important;
    max-height: 80vh !important;
    /* Ensure swiping works on small screens */
    touch-action: auto !important;
    pointer-events: auto !important;
    /* Force flipbook mode - disable scrolling */
    scrolling: no !important;
    overflow: hidden !important;
  }
  .a4-container {
    box-shadow: none !important;
    /* Allow touch gestures */
    touch-action: manipulation !important;
    /* Further reduce padding on small screens */
    padding-top: 10px !important;
    max-height: 85vh !important;
    min-height: 450px !important;
  }
  
  /* Minimal footer spacing on small screens */
  footer .h-32 {
    height: 1rem !important;
  }
  
  main {
    padding: 4px 8px !important;
  }
}

@media (max-width: 480px) {
    .a4-container {
        max-width: 95vw;
        border-radius: 0;
        max-height: 65vh;
        margin: 0;
        padding-top: 5px !important;
    }
    
    #flyerTabNavContainer {
        margin-bottom: 8px !important;
        padding-top: 0.25rem !important;
    }
    
    /* Minimal spacing on very small screens */
    main {
        padding: 2px 4px !important;
    }
    
    footer .h-32 {
        height: 0.5rem !important;
    }
}