/**
 * Modern Checkout Styles
 * 
 * Ultra-modern design for checkout page
 * 
 * @package Grabit
 * @version 1.0
 */

/* ============================================
   Checkout Page Container
   ============================================ */
.custom-checkout-page {
    min-height: 100vh;
    background-color: #f9fafb;
}

/* ============================================
   Checkout FLEXBOX Layout - EXPLICIT CSS
   ============================================ */

/* Customer Details Flex Container */
.gi-checkout-flex-container,
#customer_details {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
    width: 100% !important;
}

/* Desktop: 2-column flexbox layout */
@media (min-width: 1024px) {
    .gi-checkout-flex-container,
    #customer_details {
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 2rem !important;
    }
}

/* Left Column (Forms) - 66% width */
.gi-checkout-left {
    flex: 1 1 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
    width: 100% !important;
}

@media (min-width: 1024px) {
    .gi-checkout-left {
        flex: 1 1 66.67% !important;
        max-width: 66.67% !important;
    }
}

/* Right Column (Order Summary) - 33% width */
.gi-checkout-right {
    flex: 1 1 100% !important;
    width: 100% !important;
}

@media (min-width: 1024px) {
    .gi-checkout-right {
        flex: 0 0 33.33% !important;
        max-width: 33.33% !important;
    }
}

/* Cards inside columns */
.gi-checkout-left > div,
.gi-checkout-right > div {
    width: 100% !important;
}

/* ============================================
   Hero Section
   ============================================ */
.gi-checkout-hero {
    position: relative;
    background: linear-gradient(135deg, #5caf90 0%, #4b9b7f 50%, #3d8a6f 100%);
    overflow: hidden;
}

/* Animated Background Circles */
.checkout-circle {
    animation: floatCircle 6s ease-in-out infinite;
}

.checkout-circle:nth-child(2) {
    animation-delay: 2s;
    animation-duration: 8s;
}

.checkout-circle:nth-child(3) {
    animation-delay: 4s;
    animation-duration: 10s;
}

@keyframes floatCircle {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.1;
    }
    50% {
        transform: translateY(-20px) scale(1.1);
        opacity: 0.2;
    }
}

/* Floating Icon Animation */
.animate-float {
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ============================================
   Security Trust Bar
   ============================================ */
.gi-security-trust-bar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: linear-gradient(135deg, 
        rgba(34, 197, 94, 0.05) 0%, 
        rgba(59, 130, 246, 0.05) 50%, 
        rgba(147, 51, 234, 0.05) 100%);
}

.gi-security-trust-bar .w-10 {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.gi-security-trust-bar .flex > div:hover .w-10 {
    transform: scale(1.1);
}

/* ============================================
   Bottom Trust Section
   ============================================ */
.gi-bottom-trust {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gi-bottom-trust .grid > div {
    transition: transform 0.3s ease;
}

.gi-bottom-trust .grid > div:hover {
    transform: scale(1.05);
}

.gi-bottom-trust .w-16 {
    transition: all 0.3s ease;
}

.gi-bottom-trust .grid > div:hover .w-16 {
    transform: rotate(360deg);
}

/* ============================================
   Form Enhancements
   ============================================ */

/* Form Row States */
.gi-form-row {
    position: relative;
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}

.gi-form-row.focused {
    z-index: 10;
}

.gi-form-row.focused label {
    color: #5caf90;
    font-weight: 700;
}

.gi-form-row.filled label {
    font-weight: 600;
}

/* ============================================
   Validation States
   ============================================ */

/* Invalid */
.woocommerce-invalid {
    position: relative;
}

.woocommerce-invalid input,
.woocommerce-invalid select,
.woocommerce-invalid textarea {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.woocommerce-invalid label {
    color: #dc2626 !important;
}

/* Validated */
.woocommerce-validated input,
.woocommerce-validated select,
.woocommerce-validated textarea {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}

.woocommerce-validated::after {
    content: '✓';
    position: absolute;
    right: 1rem;
    top: 50%;
    color: #10b981;
    font-weight: 700;
    font-size: 1.25rem;
}

/* Inline Error Messages */
.gi-inline-error {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ============================================
   Error Messages
   ============================================ */
.woocommerce-error,
.woocommerce-NoticeGroup-checkout {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 4px solid #ef4444;
    color: #991b1b;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.1);
}

/* Shake Animation for Errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ============================================
   Loading States
   ============================================ */
.gi-modern-checkout.processing {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.gi-modern-checkout.processing::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Spinner Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Loading Button */
#place_order.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

#place_order.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: inherit;
}

/* ============================================
   Sticky Order Summary
   ============================================ */
.gi-sticky-summary {
    position: relative !important;
}

@media (min-width: 1024px) {
    .gi-sticky-summary {
        position: sticky !important;
        top: 2rem !important;
        max-height: calc(100vh - 4rem) !important;
        overflow-y: auto !important;
        align-self: flex-start !important;
    }
}

/* ============================================
   Space Utilities
   ============================================ */
.gi-modern-checkout .space-y-6 > * + * {
    margin-top: 1.5rem;
}

.gi-modern-checkout .gap-6 {
    gap: 1.5rem;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1023px) {
    .gi-modern-checkout .grid {
        grid-template-columns: 1fr !important;
    }
    
    .gi-modern-checkout .lg\:col-span-2,
    .gi-modern-checkout .lg\:col-span-1 {
        grid-column: span 1 / span 1;
    }
}

@media (max-width: 768px) {
    .gi-checkout-hero {
        padding: 2rem 0;
    }
    
    .gi-checkout-hero h1 {
        font-size: 2rem;
    }
    
    .gi-security-trust-bar .flex {
        flex-direction: column;
        gap: 1rem;
    }
    
    .gi-bottom-trust .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .gi-modern-checkout .space-y-6 > * + * {
        margin-top: 1rem;
    }
}

/* ============================================
   Accessibility
   ============================================ */
.gi-form-row input:focus-visible,
.gi-form-row select:focus-visible,
.gi-form-row textarea:focus-visible {
    outline: 2px solid #5caf90;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .gi-form-row input,
    .gi-form-row select,
    .gi-form-row textarea {
        border-width: 3px;
    }
}

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

/* ============================================
   Card Styling
   ============================================ */
.gi-modern-checkout .bg-white.rounded-xl {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #f3f4f6;
    transition: all 0.3s ease;
}

.gi-modern-checkout .bg-white.rounded-xl:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Tailwind Utility Classes (Fallbacks)
   ============================================ */
.gi-modern-checkout .max-w-7xl {
    max-width: 80rem;
}

.gi-modern-checkout .mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.gi-modern-checkout .p-6 {
    padding: 1.5rem;
}

.gi-modern-checkout .mb-6 {
    margin-bottom: 1.5rem;
}

.gi-modern-checkout .pb-4 {
    padding-bottom: 1rem;
}

.gi-modern-checkout .border-b {
    border-bottom-width: 1px;
}

.gi-modern-checkout .border-gray-200 {
    border-color: #e5e7eb;
}

.gi-modern-checkout .text-xl {
    font-size: 1.25rem;
}

.gi-modern-checkout .font-bold {
    font-weight: 700;
}

.gi-modern-checkout .text-gray-800 {
    color: #1f2937;
}

.gi-modern-checkout .text-gray-500 {
    color: #6b7280;
}

.gi-modern-checkout .text-sm {
    font-size: 0.875rem;
}

/* ============================================
   WooCommerce Default Overrides
   ============================================ */
.gi-modern-checkout .woocommerce-billing-fields,
.gi-modern-checkout .woocommerce-shipping-fields,
.gi-modern-checkout .woocommerce-additional-fields {
    margin-bottom: 0;
}

.gi-modern-checkout .woocommerce-billing-fields__field-wrapper,
.gi-modern-checkout .woocommerce-shipping-fields__field-wrapper,
.gi-modern-checkout .woocommerce-additional-fields__field-wrapper {
    display: block;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .gi-checkout-hero,
    .gi-security-trust-bar,
    .gi-bottom-trust {
        display: none;
    }
    
    .gi-modern-checkout .grid {
        grid-template-columns: 1fr !important;
    }
}
