/* ============================================
   EF.DELIVERY PRODUCT LANDING PAGE
   Flutter-like Modern Design
   ============================================ */

:root {
    --primary-color: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --accent-orange: #FF9800;
    --success-green: #4CAF50;
    --error-red: #EF4444;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.product-landing {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.loading-spinner-large {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.error-content {
    text-align: center;
    padding: 40px;
}

.error-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.error-content h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-back-home {
    display: inline-block;
    padding: 14px 28px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
}

.btn-back-home:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ============================================
   MAIN PRODUCT LAYOUT
   ============================================ */

.product-main {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-primary);
    min-height: 100vh;
}

@media (min-width: 768px) {
    .product-main {
        max-width: 480px;
        box-shadow: var(--shadow-lg);
    }
}

/* ============================================
   IMAGE GALLERY SECTION
   ============================================ */

.image-gallery-section {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.image-gallery {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.image-gallery::-webkit-scrollbar {
    display: none;
}

.gallery-slide {
    min-width: 100%;
    height: 100%;
    scroll-snap-align: start;
    cursor: pointer;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Labels */
.product-labels {
    position: absolute;
    top: 60px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.label-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    box-shadow: var(--shadow-md);
}

.label-promo { background: var(--error-red); }
.label-low-stock { background: var(--accent-orange); }
.label-popular { background: var(--success-green); }
.label-free-delivery { background: var(--primary-color); }

/* Image Indicators */
.image-indicators {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: var(--transition);
    cursor: pointer;
}

.indicator-dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

/* Navigation Buttons */
.btn-back, .btn-share {
    position: absolute;
    top: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 10;
    transition: var(--transition);
}

.btn-back { left: 16px; }
.btn-share { right: 16px; }

.btn-back:hover, .btn-share:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   PRODUCT INFO SECTION
   ============================================ */

.product-info-section {
    padding: 24px 20px;
}

.product-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.product-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-secondary);
}

.rating-stars {
    color: #FFC107;
}

.product-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.price-current {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.price-old {
    font-size: 16px;
    color: var(--text-light);
    text-decoration: line-through;
    margin-left: 12px;
}

.stock-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.stock-badge.in-stock {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-green);
}

.stock-badge.low-stock {
    background: rgba(255, 152, 0, 0.1);
    color: var(--accent-orange);
}

.stock-badge.out-of-stock {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-red);
}

/* ============================================
   VARIANTS SECTION
   ============================================ */

.variants-section {
    padding: 0 20px 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.variants-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.variants-scroll::-webkit-scrollbar {
    display: none;
}

.variant-card {
    min-width: 100px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-primary);
    text-align: center;
}

.variant-card:hover {
    border-color: var(--primary-light);
}

.variant-card.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.variant-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin: 0 auto 8px;
}

.variant-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.variant-price {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
}

/* ============================================
   SELLER SECTION
   ============================================ */

.seller-section {
    padding: 0 20px 24px;
}

.seller-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.seller-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.seller-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.seller-info {
    flex: 1;
}

.seller-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.verified-badge {
    background: var(--primary-color);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.seller-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.seller-actions {
    display: flex;
    gap: 12px;
}

.btn-seller-action {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-seller-contact {
    background: var(--primary-color);
    color: white;
    border: none;
}

.btn-seller-contact:hover {
    background: var(--primary-dark);
}

.btn-seller-shop {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-seller-shop:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* ============================================
   DESCRIPTION & DETAILS SECTIONS
   ============================================ */

.description-section, .details-section {
    padding: 0 20px 24px;
}

.expandable-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
}

.section-header:hover {
    background: var(--bg-secondary);
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    font-size: 20px;
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-toggle {
    font-size: 20px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.section-toggle.expanded {
    transform: rotate(180deg);
}

.section-content {
    padding: 0 20px 20px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Markdown Styling */
.markdown-content strong, .markdown-content b {
    font-weight: 700;
    color: var(--text-primary);
}

.markdown-content em, .markdown-content i {
    font-style: italic;
}

.markdown-content p {
    margin-bottom: 12px;
}

.markdown-content ul, .markdown-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.markdown-content li {
    margin-bottom: 6px;
}

/* ============================================
   DELIVERY SECTION
   ============================================ */

.delivery-section {
    padding: 0 20px 24px;
}

.delivery-card {
    background: rgba(76, 175, 80, 0.05);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.delivery-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.delivery-icon {
    font-size: 24px;
}

.delivery-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.delivery-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.delivery-free {
    color: var(--success-green);
    font-weight: 700;
}

/* ============================================
   SIMILAR PRODUCTS
   ============================================ */

.similar-products-section {
    padding: 0 20px 24px;
}

.similar-products-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.similar-products-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.similar-products-grid::-webkit-scrollbar {
    display: none;
}

.similar-product-card {
    min-width: 140px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.similar-product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.similar-product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.similar-product-info {
    padding: 12px;
}

.similar-product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.similar-product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Bottom Spacer */
.bottom-spacer {
    height: 120px;
}

/* ============================================
   FIXED BOTTOM ACTION BAR
   ============================================ */

.bottom-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 100;
}

@media (min-width: 768px) {
    .bottom-action-bar {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

.action-bar-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.action-price {
    display: flex;
    flex-direction: column;
}

.price-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.price-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-color);
}

.btn-action-primary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

/* Animated Button Glow Effect */
.btn-action-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        rgba(255, 255, 255, 0.5), 
        rgba(255, 255, 255, 0.2), 
        transparent
    );
    background-size: 200% 100%;
    animation: btnGlowSweep 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes btnGlowSweep {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.btn-action-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-action-primary:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 20px;
}

/* ============================================
   VARIANT SELECTOR POPUP
   ============================================ */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.popup-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.popup-header {
    padding: 12px;
    display: flex;
    justify-content: center;
}

.popup-drag-handle {
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

.popup-product-preview {
    margin: 0 20px 16px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.popup-product-preview img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.popup-product-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
}

.popup-product-name {
    font-size: 16px;
    font-weight: 600;
}

.popup-variant-name {
    font-size: 13px;
    opacity: 0.8;
}

.popup-price-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--shadow-md);
}

.popup-stock-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.popup-stock-badge.in-stock { background: var(--success-green); }
.popup-stock-badge.out-of-stock { background: var(--error-red); }

.popup-variants {
    padding: 0 20px 16px;
}

.popup-variants-title {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
}

.popup-variants-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    justify-content: center;
}

/* Guest Form */
.guest-form {
    margin: 0 20px 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
}

.form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.form-icon {
    font-size: 24px;
}

.form-header h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.form-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.form-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.phone-input {
    display: flex;
    gap: 8px;
}

.phone-input select {
    width: 100px;
    padding: 12px;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-primary);
    transition: var(--transition);
    cursor: pointer;
}

.phone-input select:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.phone-input input {
    flex: 1;
    border: 2px solid var(--primary-color);
}

.phone-error {
    font-size: 12px;
    color: var(--error-red);
    margin-top: 4px;
}

/* Popup Price */
.popup-price {
    margin: 0 20px 12px;
    padding: 14px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
}

/* Popup Action Button */
.btn-popup-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: calc(100% - 40px);
    margin: 0 20px 12px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-popup-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-popup-action:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-popup-action .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* AI Disclaimer */
.ai-disclaimer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 20px 20px;
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--primary-color);
}

.info-icon {
    font-size: 14px;
}

/* ============================================
   FULL SCREEN IMAGE VIEWER
   ============================================ */

.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 300;
    display: flex;
    flex-direction: column;
}

.viewer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.viewer-close:hover {
    background: rgba(255,255,255,0.2);
}

.viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.viewer-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.viewer-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 20px;
}

.viewer-prev, .viewer-next {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: var(--transition);
}

.viewer-prev:hover, .viewer-next:hover {
    background: rgba(255,255,255,0.2);
}

.viewer-counter {
    color: white;
    font-size: 14px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 480px) {
    .product-name {
        font-size: 20px;
    }
    
    .price-current {
        font-size: 24px;
    }
    
    .seller-actions {
        flex-direction: column;
    }
    
    .btn-seller-action {
        width: 100%;
    }
}
