/* Mobile-First Checkout Design */
/* Optimized for 360-430px width with compact spacing */

.checkout-mobile-container {
    max-width: 430px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: 120px; /* Space for sticky footer */
}

.guest-notice-compact {
    padding: 8px 0;
    margin-bottom: 12px;
    text-align: center;
}

.checkout-scroll-content {
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    padding-bottom: 140px; /* Extra space for sticky footer */
    
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.checkout-scroll-content::-webkit-scrollbar {
    display: none; /* WebKit browsers (Chrome, Safari, Edge) */
}

/* Section Styling */
.checkout-section {
    margin-bottom: 16px;
    padding: 12px 0;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #212529;
}

.section-caption {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 12px;
    margin-top: -4px;
}

/* Form Controls */
.form-group {
    margin-bottom: 8px;
}

.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    background: #fff;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.form-input.half-width {
    flex: 1;
}

.address-field {
    height: 60px;
    padding: 8px 12px;
    resize: none;
}

/* Checkbox Styling */
.checkbox-group {
    margin: 10px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    accent-color: #000;
}

.checkmark {
    margin-left: 4px;
}

/* Shipping Method Options */
.shipping-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shipping-option {
    display: block;
    cursor: pointer;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0;
    margin: 0;
    transition: all 0.2s ease;
    background: #fff;
}

.shipping-option:hover {
    border-color: #adb5bd;
}

.shipping-option input[type="radio"] {
    display: none;
}

.shipping-option input[type="radio"]:checked + .option-content {
    background-color: #f8f9fa;
    border-color: #000;
}

.shipping-option input[type="radio"]:checked ~ * {
    border-color: #000;
}

.shipping-option:has(input:checked) {
    border-color: #000;
    background-color: #f8f9fa;
}

.option-content {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.option-info {
    flex: 1;
}

.option-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #212529;
    margin-bottom: 2px;
}

.option-subtitle {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Order Summary Section */
.order-summary-section {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.summary-header {
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e9ecef;
}

.expand-icon {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.summary-header.collapsed .expand-icon {
    transform: rotate(-90deg);
}

.summary-content {
    padding: 12px 16px;
    max-height: auto;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.summary-content.collapsed {
    max-height: 0;
    padding: 0 16px;
}

.order-items {
    margin-bottom: 12px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
}

.order-item:last-child {
    border-bottom: none;
}

.item-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.item-details {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2px;
    line-height: 1.3;
}

.item-variant {
    font-size: 0.75rem;
    color: #6c757d;
}

.item-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    flex-shrink: 0;
}

/* Discount Row */
.discount-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.discount-input {
    flex: 1;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.apply-btn {
    padding: 0 12px;
    height: 36px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.apply-btn:hover {
    background: #333;
}

/* Order Totals */
.order-totals {
    padding: 12px 16px;
    border-top: 1px solid #e9ecef;
    background: #fff;
}

.total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.9rem;
}

.total-line.discount-line {
    color: #28a745;
}

.total-line.final-total {
    font-weight: bold;
    font-size: 1rem;
    border-top: 1px solid #e9ecef;
    padding-top: 8px;
    margin-top: 8px;
}

/* Sticky Footer - Mobile Only */
.checkout-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 12px 16px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: block;
}

/* Desktop Order Button */
.desktop-order-button {
    padding: 16px 0;
    border-top: 1px solid #e9ecef;
    margin-top: 16px;
    display: none;
}

.footer-total {
    text-align: center;
    margin-bottom: 8px;
}

.total-label {
    font-size: 0.9rem;
    color: #6c757d;
}

.total-amount {
    font-size: 1.1rem;
    font-weight: bold;
    color: #212529;
}

.complete-order-btn {
    width: 100%;
    height: 48px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 6px;
}

.complete-order-btn:hover {
    background: #333;
    transform: translateY(-1px);
}

.complete-order-btn:active {
    transform: translateY(0);
}

.security-note {
    text-align: center;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 4px;
}

/* Desktop Responsive Behavior */
@media (min-width: 769px) {
    .checkout-mobile-container {
        display: block !important;
        max-width: 800px;
        margin: 0 auto;
        padding: 32px;
    }
    
    .checkout-scroll-content {
        max-height: none;
        overflow: visible;
    }
    
    .checkout-section {
        margin-bottom: 32px;
        padding: 24px;
        background: #fff;
        border-radius: 8px;
        border: 1px solid #e9ecef;
    }
    
    .checkout-footer {
        display: none !important;
    }
    
    .desktop-order-button {
        display: block !important;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .checkout-mobile-container {
        display: block !important;
    }
    
    .checkout-footer {
        display: none !important;
    }
    
    .desktop-order-button {
        display: block !important;
    }
}

@media (max-width: 480px) {
    .checkout-mobile-container {
        padding: 0 12px;
        max-width: 100%;
    }
    
    .form-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .form-row {
        gap: 6px;
    }
    
    .form-group {
        margin-bottom: 6px;
    }
    
    .checkout-section {
        margin-bottom: 12px;
    }
}

/* Focus and Keyboard Navigation */
.form-input:focus,
.shipping-option:focus-within,
.checkbox-label:focus-within {
    outline: 2px solid #000;
    outline-offset: 1px;
}

/* Loading States */
.form-input:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Error States */
.form-input.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

.error-message {
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 2px;
    display: none;
}

.form-input.error + .error-message {
    display: block;
}
