/**
 * YUVANA Product Manager - Frontend Styles
 * 
 * @package YUVANA_Product_Manager
 * @since 1.0.0
 */

 
/* ==========================================================================
   Variables & Fonts
   ========================================================================== */

:root {
    --yuvana-primary: #75C7B7;
    --yuvana-primary-dark: #5AB5A3;
	--yuvana-primary2: #79ccbc;
    --yuvana-secondary: #667eea;
    --yuvana-danger: #ef4444;
    --yuvana-success: #10b981;
    --yuvana-warning: #f59e0b;
    --yuvana-gray-50: #f9fafb;
    --yuvana-gray-100: #f3f4f6;
    --yuvana-gray-200: #e5e7eb;
    --yuvana-gray-300: #d1d5db;
    --yuvana-gray-400: #9ca3af;
    --yuvana-gray-500: #6b7280;
    --yuvana-gray-600: #4b5563;
    --yuvana-gray-700: #374151;
    --yuvana-gray-800: #1f2937;
    --yuvana-gray-900: #111827;
    --yuvana-radius: 12px;
    --yuvana-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --yuvana-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Product State Badge
   ========================================================================== */
/* Pre-Launch Badge in Hover */
.pre-launch-badge {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.yuvana-state-badge-wrapper {
    margin-bottom: 20px;
}

.yuvana-state-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.yuvana-state-badge .badge-icon {
    font-size: 18px;
    line-height: 1;
}

.yuvana-state-badge.state-pre-launch {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.yuvana-state-badge.state-on-sale {
    background: linear-gradient(135deg, var(--yuvana-primary) 0%, var(--yuvana-primary-dark) 100%);
    color: white;
}

.yuvana-state-badge.state-sold-out {
    background: var(--yuvana-gray-200);
    color: var(--yuvana-gray-700);
}

/* ==========================================================================
   Countdown Timer
   ========================================================================== */

.yuvana-countdown-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 40px;
    border-radius: var(--yuvana-radius);
    margin: 30px 0;
    text-align: center;
    box-shadow: var(--yuvana-shadow-lg);
}

.countdown-header {
    margin-bottom: 30px;
}

.countdown-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--yuvana-gray-800);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
}

.time-unit {
    background: white;
    padding: 20px;
    border-radius: var(--yuvana-radius);
    box-shadow: var(--yuvana-shadow);
    min-width: 90px;
    transition: transform 0.3s ease;
}

.time-unit:hover {
    transform: translateY(-5px);
}

.time-value {
    font-size: 48px;
    font-weight: 700;
    color: var(--yuvana-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.time-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--yuvana-gray-600);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
}

.time-separator {
    font-size: 36px;
    font-weight: 700;
    color: var(--yuvana-gray-400);
}

.countdown-footer {
    margin-top: 30px;
}

.countdown-launch-date {
    font-size: 16px;
    color: var(--yuvana-gray-600);
    margin: 0;
}

/* Countdown Launched State */
.yuvana-countdown-launched {
    text-align: center;
    padding: 60px 40px;
}

.launched-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounceIn 1s ease;
}

.launched-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--yuvana-success);
    margin: 0 0 10px 0;
}

.launched-text {
    font-size: 16px;
    color: var(--yuvana-gray-600);
    margin-bottom: 30px;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}
.yuvana-reload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.yuvana-reload-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.yuvana-reload-btn:active {
    transform: translateY(-1px);
}

/* ==========================================================================
   Waitlist Section
   ========================================================================== */

.yuvana-waitlist-section {
    background: white;
    padding: 40px;
    border-radius: var(--yuvana-radius);
    margin: 30px 0;
    border: 2px solid var(--yuvana-gray-200);
    box-shadow: var(--yuvana-shadow);
}

.waitlist-header {
    text-align: center;
    margin-bottom: 30px;
}

.waitlist-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--yuvana-gray-800);
    margin: 0 0 10px 0;
}

.waitlist-description {
    font-size: 16px;
    color: var(--yuvana-gray-600);
    line-height: 1.6;
    margin: 0;
}

/* Waitlist Form */
.yuvana-waitlist-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.input-wrapper {
    position: relative;
}

.waitlist-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 16px;
    border: 2px solid var(--yuvana-gray-300);
    border-radius: var(--yuvana-radius);
    transition: all 0.3s ease;
    background: white;
}

.waitlist-input:focus {
    outline: none;
    border-color: var(--yuvana-primary);
    box-shadow: 0 0 0 3px rgba(117, 199, 183, 0.1);
}

.input-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    pointer-events: none;
}

/* Submit Button */
.btn-join-waitlist {
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    color: white !important;
    background: linear-gradient(135deg, var(--yuvana-primary2) 0%, var(--yuvana-primary2) 100%) !important;
    border: none;
    border-radius: 20px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--yuvana-shadow);
}

.btn-join-waitlist:hover {
    transform: translateY(-2px);
    box-shadow: var(--yuvana-shadow-lg);
}

.btn-join-waitlist:hover:not(:disabled) {
    background: linear-gradient(135deg, #5AB5A3 0%, #4A9D8F 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(117, 199, 183, 0.4);
}

.btn-join-waitlist:active:not(:disabled) {
    transform: translateY(0);
}
.btn-join-waitlist:active {
    transform: translateY(0);
}

.btn-join-waitlist:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-join-waitlist:disabled .btn-loading {
    display: inline-flex;
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Form Messages - Enhanced
   ========================================================================== */

.yuvana-waitlist-message,
.form-message {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: none; 
}

/*  Success Message */
.form-message.success,
.yuvana-waitlist-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #6ee7b7;
    display: flex !important;
    align-items: center;
    gap: 10px;
}

.form-message.success::before,
.yuvana-waitlist-message.success::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

/*  Error Message */
.form-message.error,
.yuvana-waitlist-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #fca5a5;
    display: flex !important; 
    align-items: center;
    gap: 10px;
}

.form-message.error::before,
.yuvana-waitlist-message.error::before {
    content: "⚠";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0; 
}

/*  Warning Message */
.form-message.warning,
.yuvana-waitlist-message.warning {
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #fcd34d;
    display: flex !important; 
    align-items: center;
    gap: 10px;
}

.form-message.warning::before,
.yuvana-waitlist-message.warning::before {
    content: "ℹ";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    /*background: #f59e0b;*/
    color: white;
    /*border-radius: 50%;*/
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0; 
}


/* ==========================================================================
   Waitlist Success State (หลัง Join สำเร็จ)
   ========================================================================== */

.waitlist-already-joined {
    text-align: center;
    padding: 40px 30px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 12px;
    border: 2px solid #6ee7b7;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 48px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    animation: popIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-message {
    font-size: 20px;
    font-weight: 600;
    color: #065f46;
    margin: 0 0 10px 0;
}

.success-submessage {
    font-size: 16px;
    color: #047857;
    margin: 0;
    opacity: 0.9;
}

/* ==========================================================================
   Form Row Layout
   ========================================================================== */

.form-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.waitlist-email-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.waitlist-email-input:focus {
    outline: none;
    border-color: #75C7B7;
    box-shadow: 0 0 0 3px rgba(117, 199, 183, 0.1);
}

.waitlist-email-input::placeholder {
    color: #9ca3af;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .btn-join-waitlist {
        padding: 14px 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
}
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .waitlist-email-input,
    .btn-join-waitlist {
        width: 100%;
    }
    
    .waitlist-already-joined {
        padding: 30px 20px;
    }
    
    .success-icon {
        width: 60px;
        height: 60px;
        font-size: 36px;
    }
    
    .success-message {
        font-size: 18px;
    }
    
    .success-submessage {
        font-size: 14px;
    }
}
/* Form Footer */
.form-footer {
    margin-top: 20px;
    text-align: center;
}

.privacy-notice {
    font-size: 13px;
    color: var(--yuvana-gray-500);
    line-height: 1.5;
}

.privacy-notice a {
    color: var(--yuvana-primary);
    text-decoration: none;
    font-weight: 500;
}

.privacy-notice a:hover {
    text-decoration: underline;
}

/* Already Joined State */
.waitlist-already-joined {
    text-align: center;
    padding: 40px;
    background: #d1fae5;
    border-radius: var(--yuvana-radius);
}

.success-icon {
    width: 60px;
    height: 60px;
    background: var(--yuvana-success);
    color: white;
    font-size: 32px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.success-message {
    font-size: 18px;
    font-weight: 500;
    color: #065f46;
    margin: 0;
}

/* Waitlist Stats */
.waitlist-stats {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--yuvana-gray-500);
    font-weight: 500;
}
/* ==========================================================================
   Minimal Countdown (Shop/Archive & Loop Template)
   ========================================================================== */

.yuvana-countdown-minimal {
    text-align: center;
    padding: 15px 10px;
    background: #f8f9fa;
    border-radius: 20px;
    margin-top: 10px;
}

.countdown-minimal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #79CCBC 0%, #b5e5d6 100%);
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.countdown-minimal-badge .badge-icon {
    font-size: 14px;
}

.countdown-minimal-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 10px 0;
}

.countdown-minimal-timer .minimal-unit {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 35px;
}

.countdown-minimal-timer .minimal-number {
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    color: #1a1a1a;
    font-family: 'Courier New', monospace;
}

.countdown-minimal-timer .minimal-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #666;
    margin-top: 2px;
    font-weight: 500;
}

.countdown-minimal-timer .minimal-separator {
    font-size: 16px;
    font-weight: 600;
    color: #999;
    margin: 0 2px;
}

.countdown-minimal-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e5e5;
}

.countdown-minimal-date {
    font-size: 11px;
    color: #666;
    margin: 0;
}

.countdown-minimal-date strong {
    color: #333;
    font-weight: 600;
}

/* Animation for minimal countdown */
.countdown-minimal-timer .minimal-number.flip-animation {
    animation: flipMinimal 0.3s ease-in-out;
}

@keyframes flipMinimal {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.8); }
}

/* Responsive - Mobile */
@media (max-width: 767px) {
    .yuvana-countdown-minimal {
        padding: 12px 8px;
    }
    
    .countdown-minimal-timer .minimal-number {
        font-size: 18px;
    }
    
    .countdown-minimal-timer .minimal-unit {
        min-width: 30px;
    }
}

/* ใน WooCommerce loop */
.woocommerce ul.products li.product .yuvana-countdown-minimal {
    margin: 15px 0 0 0;
}

/* ใน Elementor loop (shortcode) */
.yuvana-shortcode-wrapper.yuvana-countdown-minimal-shortcode {
    margin: 10px 0;
}

.yuvana-shortcode-wrapper.yuvana-countdown-minimal-shortcode .yuvana-countdown-minimal {
    margin: 0;
}
/* ==========================================================================
   Product Hover Effects (Elementor Loop)
   ========================================================================== */

.product-hover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.elementor-loop-item:hover .product-hover-image {
    opacity: 1;
}

.product-hover-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    text-decoration: none;
}

.product-hover-container {
    width: 100%;
    height: 100%;
}

.product-hover-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    padding: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.elementor-loop-item:hover .product-hover-overlay {
    opacity: 1;
    transform: translateY(0);
}

.product-hover-content {
    color: white;
}

.hover-product-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: white;
}

.hover-product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--yuvana-primary);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .yuvana-countdown-container {
        padding: 30px 20px;
    }
    
    .countdown-title {
        font-size: 22px;
    }
    
    .countdown-timer {
        gap: 8px;
    }
    
    .time-unit {
        padding: 15px 10px;
        min-width: 70px;
    }
    
    .time-value {
        font-size: 32px;
    }
    
    .time-label {
        font-size: 10px;
    }
    
    .time-separator {
        font-size: 24px;
    }
    
    .yuvana-waitlist-section {
        padding: 30px 20px;
    }
    
    .waitlist-title {
        font-size: 22px;
    }
    
    .waitlist-description {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .countdown-timer {
        flex-wrap: wrap;
    }
    
    .time-separator {
        display: none;
    }
    
    .time-unit {
        flex: 0 0 calc(50% - 8px);
        margin-bottom: 8px;
    }
}

/* ==========================================================================
   Dark Mode Support (optional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    body.dark-mode .yuvana-countdown-container {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }
    
    body.dark-mode .countdown-title {
        color: white;
    }
    
    body.dark-mode .time-unit {
        background: #374151;
    }
    
    body.dark-mode .yuvana-waitlist-section {
        background: #1f2937;
        border-color: #374151;
    }
    
    body.dark-mode .waitlist-title {
        color: white;
    }
    
    body.dark-mode .waitlist-input {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.yuvana-countdown-container:focus-within,
.yuvana-waitlist-section:focus-within {
    outline: 3px solid var(--yuvana-primary);
    outline-offset: 2px;
}

.waitlist-input:focus {
    outline: none;
}

.btn-join-waitlist:focus-visible {
    outline: 3px solid var(--yuvana-primary);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}
/* ==========================================================================
   WooCommerce Default Archive/Shop Hover
   ========================================================================== */

/* Hover image for WooCommerce default template */
.woocommerce ul.products li.product .product-hover-image.woo-default-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.woocommerce ul.products li.product:hover .product-hover-image.woo-default-hover {
    opacity: 1;
}

/* Simple overlay for WooCommerce default (optional) */
.yuvana-simple-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    text-align: center;
    z-index: 10;
}

.pre-launch-badge-simple,
.sold-out-badge-simple {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.pre-launch-badge-simple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ==========================================================================
   Elementor Loop Hover (ต่อจาก CSS เดิม)
   ========================================================================== */

/* CSS สำหรับ Elementor Loop ที่มีอยู่แล้ว */
.product-hover-image.elementor-loop-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.elementor-loop-item:hover .product-hover-image.elementor-loop-hover {
    opacity: 1;
}

/* ==========================================================================
   🚀 Hide Add to Cart for Pre-Launch Products
   Support: Standard WooCommerce + Elementor
   ========================================================================== */

/* Variable Products - WooCommerce Standard */
.single-product.yuvana-product-pre-launch .variations_form,
.single-product.yuvana-product-pre-launch .single_variation_wrap,
.single-product.yuvana-product-pre-launch table.variations,
.single-product.yuvana-product-pre-launch .variations_button {
    display: none !important;
}

/* Variable Products - Elementor Widget */
.single-product.yuvana-product-pre-launch .elementor-widget-woocommerce-product-add-to-cart .elementor-add-to-cart,
.single-product.yuvana-product-pre-launch .elementor-add-to-cart.elementor-product-variable,
.single-product.yuvana-product-pre-launch .e-atc-qty-button-holder {
    display: none !important;
}

/* Variable Products - Force Hide (Backup) */
body.yuvana-product-pre-launch form.variations_form.cart {
    display: none !important;
}

/* Simple Products - WooCommerce Standard */
.single-product.yuvana-product-pre-launch .single_add_to_cart_button,
.single-product.yuvana-product-pre-launch .cart .quantity,
.single-product.yuvana-product-pre-launch form.cart {
    display: none !important;
}

/* Simple Products - Elementor Widget */
.single-product.yuvana-product-pre-launch .elementor-add-to-cart.elementor-product-simple {
    display: none !important;
}