/**
 * MSA Order Engine - Widget Styles
 * Booking Widget (EventSingle) and Cart Widget Styles
 * 
 * @package MSA_Order_Engine
 * @since 0.8.0
 * @version 0.8.6 - Conversion-optimized complete rewrite
 */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    --msaoe-primary: #ff9933;
    --msaoe-primary-dark: #e68a2e;
    --msaoe-primary-light: #ffad5c;
    --msaoe-success: #7FB8A3;
    --msaoe-success-light: #E8F3EF;
    --msaoe-warning: #f59e0b;
    --msaoe-warning-light: #fef3c7;
    --msaoe-danger: #ef4444;
    --msaoe-danger-light: #fee2e2;
    --msaoe-text: #1f2937;
    --msaoe-text-light: #6b7280;
    --msaoe-border: #e5e7eb;
    --msaoe-bg-light: #f9fafb;
    --msaoe-radius: 16px;
    --msaoe-radius-sm: 10px;
    --msaoe-shadow: 0 10px 40px rgba(0,0,0,0.12);
    --msaoe-shadow-hover: 0 20px 60px rgba(255,153,51,0.25);
}

/* ========================================
   EVENT PAGE - CONVERSION OPTIMIZED LAYOUT
   Force proper overflow for sticky to work
   ======================================== */

body.single-msaoe_event,
body.single-msaoe_event .site,
body.single-msaoe_event .site-content,
body.single-msaoe_event .content-area,
body.single-msaoe_event main,
body.single-msaoe_event article,
body.single-msaoe_event .entry-content,
body.single-msaoe_event .post-content {
    overflow: visible !important;
    overflow-x: clip !important;
}

/* Reduce top spacing on event pages */
body.single-msaoe_event .entry-content,
body.single-msaoe_event .post-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Layout Container */
body.single-msaoe_event .msaoe-event-layout {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

/* Desktop: Content + Fixed-Width Sidebar */
@media (min-width: 992px) {
    body.single-msaoe_event .msaoe-event-layout {
        grid-template-columns: 1fr 380px !important;
        gap: 40px !important;
        align-items: start !important;
        min-height: 800px !important;
    }
    
    /* Content column */
    body.single-msaoe_event .msaoe-event-content-column {
        order: 1 !important;
        min-width: 0 !important;
    }
    
    /* Sidebar column - STICKY */
    body.single-msaoe_event .msaoe-event-sidebar-column {
        order: 2 !important;
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 100px !important;
        align-self: start !important;
        z-index: 100 !important;
    }
    
    /* Admin bar adjustment */
    body.logged-in.admin-bar.single-msaoe_event .msaoe-event-sidebar-column {
        top: 132px !important;
    }
    
    body.single-msaoe_event .msaoe-event-sidebar-column .msaoe-booking-widget {
        margin: 0 !important;
    }
}

/* Mobile: Widget first */
@media (max-width: 991px) {
    body.single-msaoe_event .msaoe-event-layout {
        padding: 15px !important;
    }
    
    body.single-msaoe_event .msaoe-event-content-column {
        order: 2 !important;
    }
    
    body.single-msaoe_event .msaoe-event-sidebar-column {
        order: 1 !important;
        position: relative !important;
    }
}

/* ========================================
   BOOKING WIDGET - CONVERSION OPTIMIZED
   ======================================== */

.msaoe-booking-widget {
    background: #ffffff;
    border: 1px solid var(--msaoe-border);
    border-radius: var(--msaoe-radius);
    box-shadow: var(--msaoe-shadow);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.msaoe-booking-widget:hover {
    box-shadow: var(--msaoe-shadow-hover);
}

/* Widget Header - Orange Gradient */
.msaoe-booking-widget-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--msaoe-primary) 0%, var(--msaoe-primary-dark) 100%);
    color: white;
    margin: 0;
    border-bottom: none;
}

.msaoe-booking-widget-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1.2em !important;
    font-weight: 700 !important;
    color: white !important;
    line-height: 1.3 !important;
    border: none !important;
    background: none !important;
}

/* ========================================
   AVAILABILITY & URGENCY INDICATORS
   ======================================== */

.msaoe-availability-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    margin: 20px 20px 0;
    border-radius: var(--msaoe-radius-sm);
    font-weight: 600;
    font-size: 0.95em;
}

.msaoe-availability-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

/* Green - Plenty Available */
.msaoe-availability-ok {
    background: var(--msaoe-success-light);
    color: #166534;
    border: 1px solid #86efac;
}

/* Purple - Time-based Urgency */
.msaoe-urgency-time {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

/* Yellow - Medium Urgency */
.msaoe-urgency-medium {
    background: var(--msaoe-warning-light);
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Orange - High Urgency */
.msaoe-urgency-high {
    background: #fed7aa;
    color: #c2410c;
    border: 1px solid #fb923c;
}

/* Red - Critical Urgency (Animated) */
.msaoe-urgency-critical {
    background: linear-gradient(135deg, #dc2626 0%, #ea580c 100%);
    color: white;
    border: none;
    animation: msaoe-pulse 2s infinite;
}

@keyframes msaoe-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.9; }
}

/* ========================================
   BOOKING FORM
   ======================================== */

.msaoe-booking-form {
    padding: 20px;
}

.msaoe-booking-field {
    margin-bottom: 16px;
}

.msaoe-booking-field:last-of-type {
    margin-bottom: 0;
}

.msaoe-booking-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--msaoe-text);
}

/* Select Dropdown */
.msaoe-select {
    width: 100%;
    padding: 14px 44px 14px 16px;
    font-size: 1em;
    border: 2px solid var(--msaoe-border);
    border-radius: var(--msaoe-radius-sm);
    background: white;
    color: var(--msaoe-text);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.msaoe-select:hover {
    border-color: var(--msaoe-primary-light);
}

.msaoe-select:focus {
    outline: none;
    border-color: var(--msaoe-primary);
    box-shadow: 0 0 0 4px rgba(255, 153, 51, 0.15);
}

/* Field Notes */
.msaoe-field-note,
.msaoe-hint {
    margin: 8px 0 0;
    font-size: 0.85em;
    color: var(--msaoe-text-light);
}

/* ========================================
   PRICE DISPLAY
   ======================================== */

.msaoe-booking-price {
    margin: 20px 0;
    padding: 16px 20px;
    background: var(--msaoe-bg-light);
    border-radius: var(--msaoe-radius-sm);
}

.msaoe-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.msaoe-price-label {
    font-size: 1em;
    color: var(--msaoe-text-light);
    font-weight: 500;
}

.msaoe-price-value {
    font-size: 1.75em;
    font-weight: 800;
    color: var(--msaoe-primary);
}

.msaoe-price-note {
    margin: 8px 0 0;
    font-size: 0.85em;
    color: var(--msaoe-text-light);
}

/* ========================================
   BOOKING INFO BOX
   ======================================== */

.msaoe-booking-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin: 16px 0;
    background: #F3EDFA;
    border-radius: var(--msaoe-radius-sm);
    font-size: 0.9em;
    color: #6B4FA3;
}

.msaoe-info-icon {
    flex-shrink: 0;
}

/* ========================================
   CTA BUTTON - MAXIMUM VISIBILITY
   ======================================== */

.msaoe-booking-widget .msaoe-button-primary,
.msaoe-booking-widget button[type="submit"],
.msaoe-booking-form .msaoe-button-primary {
    display: block !important;
    width: 100% !important;
    margin: 20px 0 0 !important;
    padding: 18px 24px !important;
    font-size: 1.1em !important;
    font-weight: 700 !important;
    text-align: center !important;
    background: linear-gradient(135deg, var(--msaoe-primary) 0%, var(--msaoe-primary-dark) 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.4) !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
}

.msaoe-booking-widget .msaoe-button-primary:hover,
.msaoe-booking-widget button[type="submit"]:hover,
.msaoe-booking-form .msaoe-button-primary:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 25px rgba(255, 153, 51, 0.5) !important;
    background: linear-gradient(135deg, var(--msaoe-primary-dark) 0%, #d4791f 100%) !important;
}

.msaoe-booking-widget .msaoe-button-primary:active,
.msaoe-booking-widget button[type="submit"]:active {
    transform: translateY(-1px) !important;
}

/* Disabled State */
.msaoe-booking-widget .msaoe-button-primary:disabled,
.msaoe-booking-widget button[type="submit"]:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ========================================
   TRUST INDICATORS
   ======================================== */

.msaoe-booking-trust {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--msaoe-border);
    font-size: 0.8em;
    color: var(--msaoe-text-light);
}

.msaoe-booking-trust span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========================================
   IN-CART STATE
   ======================================== */

.msaoe-in-cart-info {
    padding: 24px 20px;
    text-align: center;
}

.msaoe-in-cart-info > p:first-child {
    margin: 0 0 20px;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--msaoe-success);
}

.msaoe-in-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msaoe-in-cart-actions .msaoe-button {
    display: block;
    width: 100%;
    padding: 16px 20px;
    text-align: center;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1em;
    text-decoration: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

/* Primary: Zur Kasse */
.msaoe-in-cart-actions .msaoe-button-primary {
    background: linear-gradient(135deg, var(--msaoe-primary) 0%, var(--msaoe-primary-dark) 100%);
    color: white !important;
    border: none;
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.35);
}

.msaoe-in-cart-actions .msaoe-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 153, 51, 0.45);
}

/* Secondary Button */
.msaoe-in-cart-actions .msaoe-button-secondary,
.msaoe-in-cart-actions .msaoe-button:not(.msaoe-button-primary) {
    background: white;
    color: var(--msaoe-primary) !important;
    border: 2px solid var(--msaoe-primary);
}

.msaoe-in-cart-actions .msaoe-button-secondary:hover,
.msaoe-in-cart-actions .msaoe-button:not(.msaoe-button-primary):hover {
    background: var(--msaoe-primary);
    color: white !important;
}

/* Remove Link */
.msaoe-remove-link {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 16px;
    color: var(--msaoe-text-light);
    font-size: 0.9em;
    text-decoration: none;
    transition: color 0.2s;
}

.msaoe-remove-link:hover {
    color: var(--msaoe-danger);
}

/* ========================================
   PAST / SOLD OUT / CLOSED STATES
   ======================================== */

.msaoe-widget-notice {
    padding: 24px 20px;
    text-align: center;
}

.msaoe-widget-notice-icon {
    font-size: 3em;
    margin-bottom: 12px;
    display: block;
}

.msaoe-widget-notice-title {
    margin: 0 0 8px;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--msaoe-text);
}

.msaoe-widget-notice-text {
    margin: 0;
    color: var(--msaoe-text-light);
    font-size: 0.95em;
}

.msaoe-widget-notice .msaoe-button {
    margin-top: 20px;
}

/* ========================================
   FLOATING CART WIDGET (Mini Cart)
   ======================================== */

.msaoe-floating-cart {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.msaoe-floating-cart-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--msaoe-primary) 0%, var(--msaoe-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 153, 51, 0.4);
    transition: all 0.3s ease;
    font-size: 1.5em;
}

.msaoe-floating-cart-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(255, 153, 51, 0.5);
}

.msaoe-floating-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: var(--msaoe-danger);
    color: white;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mini Cart Dropdown */
.msaoe-mini-cart {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: var(--msaoe-radius);
    box-shadow: var(--msaoe-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.msaoe-floating-cart:hover .msaoe-mini-cart,
.msaoe-mini-cart.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.msaoe-mini-cart-header {
    padding: 16px 20px;
    background: var(--msaoe-bg-light);
    border-bottom: 1px solid var(--msaoe-border);
    font-weight: 600;
    border-radius: var(--msaoe-radius) var(--msaoe-radius) 0 0;
}

.msaoe-mini-cart-items {
    max-height: 300px;
    overflow-y: auto;
}

.msaoe-mini-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--msaoe-border);
}

.msaoe-mini-cart-item:last-child {
    border-bottom: none;
}

.msaoe-mini-cart-item-info {
    flex: 1;
    min-width: 0;
}

.msaoe-mini-cart-item-title {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--msaoe-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msaoe-mini-cart-item-meta {
    font-size: 0.8em;
    color: var(--msaoe-text-light);
    margin-top: 2px;
}

.msaoe-mini-cart-item-price {
    font-weight: 700;
    color: var(--msaoe-primary);
    margin-left: 12px;
}

.msaoe-mini-cart-footer {
    padding: 16px 20px;
    background: var(--msaoe-bg-light);
    border-top: 1px solid var(--msaoe-border);
    border-radius: 0 0 var(--msaoe-radius) var(--msaoe-radius);
}

.msaoe-mini-cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 700;
}

.msaoe-mini-cart-total-amount {
    color: var(--msaoe-primary);
    font-size: 1.1em;
}

.msaoe-mini-cart-checkout {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--msaoe-primary) 0%, var(--msaoe-primary-dark) 100%);
    color: white !important;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--msaoe-radius-sm);
    transition: all 0.2s;
}

.msaoe-mini-cart-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.4);
}

/* Empty Cart State */
.msaoe-mini-cart-empty {
    padding: 30px 20px;
    text-align: center;
    color: var(--msaoe-text-light);
}

/* ========================================
   MODAL (Success/Error Popups)
   ======================================== */

.msaoe-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.msaoe-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.msaoe-modal {
    background: white;
    border-radius: var(--msaoe-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 90%;
    padding: 32px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.msaoe-modal-overlay.active .msaoe-modal {
    transform: scale(1);
}

.msaoe-modal-icon {
    font-size: 3em;
    margin-bottom: 16px;
}

.msaoe-modal-icon.success {
    color: var(--msaoe-success);
}

.msaoe-modal-icon.error {
    color: var(--msaoe-danger);
}

.msaoe-modal-title {
    margin: 0 0 12px;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--msaoe-text);
}

.msaoe-modal-text {
    margin: 0 0 24px;
    color: var(--msaoe-text-light);
}

.msaoe-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msaoe-modal-actions .msaoe-button {
    padding: 14px 24px;
    border-radius: var(--msaoe-radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.msaoe-modal-actions .msaoe-button-primary {
    background: linear-gradient(135deg, var(--msaoe-primary) 0%, var(--msaoe-primary-dark) 100%);
    color: white !important;
    border: none;
}

.msaoe-modal-actions .msaoe-button-secondary {
    background: white;
    color: var(--msaoe-text) !important;
    border: 2px solid var(--msaoe-border);
}

.msaoe-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 1.5em;
    color: var(--msaoe-text-light);
    cursor: pointer;
    transition: color 0.2s;
}

.msaoe-modal-close:hover {
    color: var(--msaoe-text);
}

/* ========================================
   COUNTDOWN TIMER
   ======================================== */

.msaoe-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    margin: 16px 20px;
    background: var(--msaoe-warning-light);
    border-radius: var(--msaoe-radius-sm);
    font-weight: 600;
    color: #92400e;
}

.msaoe-countdown-icon {
    font-size: 1.2em;
}

.msaoe-countdown-time {
    font-family: monospace;
    font-size: 1.1em;
}

.msaoe-countdown.urgent {
    background: var(--msaoe-danger-light);
    color: #991b1b;
    animation: msaoe-pulse 1s infinite;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 480px) {
    .msaoe-booking-widget-header {
        padding: 16px 20px;
    }
    
    .msaoe-booking-widget-title {
        font-size: 1.1em !important;
    }
    
    .msaoe-booking-form {
        padding: 16px;
    }
    
    .msaoe-booking-trust {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .msaoe-floating-cart {
        bottom: 15px;
        right: 15px;
    }
    
    .msaoe-floating-cart-button {
        width: 54px;
        height: 54px;
    }
    
    .msaoe-mini-cart {
        width: 280px;
        right: -10px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .msaoe-floating-cart,
    .msaoe-modal-overlay {
        display: none !important;
    }
    
    .msaoe-booking-widget {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
