/* Lieferando-Style Checkout Design */

/* Reset und Basis */
.checkout-container {
    background-color: #f8f8f8;
    min-height: 100vh;
    padding: 20px 0;
    /* Reduced padding for mobile */
}

.checkout-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Mobile spacing optimizations */
@media (max-width: 768px) {
    .checkout-container {
        padding: 8px 0;
        /* Remove extra bottom padding on checkout - no footer */
        padding-bottom: 15px;
        min-height: calc(100vh - 100px); /* Account for fixed order button */
    }
    
    .checkout-wrapper {
        padding: 0 8px;
    }
}

/* Checkout Header */
.checkout-header {
    background-color: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Mobile checkout header optimization */
@media (max-width: 768px) {
    .checkout-header {
        padding: 15px;
        margin-bottom: 10px;
        border-radius: 0;
    }
}

.checkout-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
}

.checkout-step {
    display: flex;
    align-items: center;
    color: #999;
    font-size: 14px;
    position: relative;
}

.checkout-step.active {
    color: #ff8000;
    font-weight: 600;
}

.checkout-step.completed {
    color: #00a74a;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #e5e5e5;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-weight: 600;
}

.checkout-step.active .step-number {
    background-color: #ff8000;
    color: white;
}

.checkout-step.completed .step-number {
    background-color: #00a74a;
    color: white;
}

.step-divider {
    width: 60px;
    height: 2px;
    background-color: #e5e5e5;
    margin: 0 15px;
}

.checkout-step.completed + .step-divider {
    background-color: #00a74a;
}

/* Main Checkout Layout */
.checkout-main {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    /* Add bottom padding for desktop since no footer */
    padding-bottom: 40px;
}

/* Left Column - Forms */
.checkout-forms {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.checkout-forms .form-section {
    border-bottom: 1px solid #f0f0f0;
}

.checkout-forms .form-section:last-child {
    border-bottom: none;
}

/* Section Headers */
.section-header {
    background-color: #f8f8f8;
    padding: 12px 18px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
}

.section-title .icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    color: #ff8000;
}

.section-content {
    padding: 15px 18px;
}

/* Delivery Type Selector */
.delivery-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.delivery-type-option {
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.delivery-type-option:hover {
    border-color: #ff8000;
}

.delivery-type-option.active {
    border-color: #ff8000;
    background-color: #fff5e5;
}

.delivery-type-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.delivery-type-label {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 2px;
}

.delivery-type-time {
    font-size: 13px;
    color: #666;
}

/* Form Styling */


.form-section:last-child {
    margin-bottom: 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.form-group label .required {
    color: #ff4444;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s;
    background-color: #fff;
}

.form-control:focus {
    outline: none;
    border-color: #ff8000;
    box-shadow: 0 0 0 3px rgba(255, 128, 0, 0.1);
}

.form-control:disabled {
    background-color: #f8f8f8;
    cursor: not-allowed;
}

/* Saved Addresses */
.saved-addresses-list {
    margin-bottom: 15px;
}

.saved-address-item {
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px 15px 12px 45px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.saved-address-item:hover {
    border-color: #ff8000;
    box-shadow: 0 2px 8px rgba(255,128,0,0.15);
}

.saved-address-item.selected {
    border-color: #ff8000;
    background-color: #fff5e5;
    box-shadow: 0 2px 8px rgba(255,128,0,0.2);
}

.saved-address-radio {
    position: absolute;
    opacity: 0;
}

.saved-address-content {
    line-height: 1.4;
}

.saved-address-content strong {
    color: #333;
    font-weight: 600;
    font-size: 15px;
}

.saved-address-item::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background-color: #fff;
    transition: all 0.2s;
}

.saved-address-item.selected::before {
    border-color: #ff8000;
}

.saved-address-item.selected::after {
    content: '';
    position: absolute;
    left: 19px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background-color: #ff8000;
    border-radius: 50%;
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    0% { transform: translateY(-50%) scale(0); }
    100% { transform: translateY(-50%) scale(1); }
}

.add-new-address-btn {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ff8000;
    background-color: transparent;
    color: #ff8000;
    font-weight: 500;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-new-address-btn:hover {
    background-color: #fff5e5;
    border-style: solid;
}

.add-new-address-btn i {
    font-size: 16px;
}

/* Payment Methods */
.payment-methods {
    display: grid;
    gap: 12px;
}

.payment-method-item {
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.payment-method-item:hover {
    border-color: #ff8000;
}

.payment-method-item.selected {
    border-color: #ff8000;
    background-color: #fff5e5;
}

.payment-method-info {
    display: flex;
    align-items: center;
}

.payment-method-icon {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.payment-method-name {
    font-weight: 500;
    color: #333;
}

.payment-method-desc {
    font-size: 14px;
    color: #666;
    margin-top: 2px;
}

/* Right Column - Order Summary */
.checkout-summary {
    position: sticky;
    top: 20px;
}

.order-summary-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.summary-header {
    background-color: #333;
    color: white;
    padding: 15px 20px;
    font-weight: 600;
    font-size: 18px;
}

.summary-restaurant {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.restaurant-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.restaurant-info {
    font-size: 14px;
    color: #666;
}

.summary-items {
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
    max-height: 300px;
    overflow-y: auto;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.summary-item:last-child {
    margin-bottom: 0;
}

.item-details {
    flex: 1;
    margin-right: 10px;
}

.item-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.item-quantity {
    font-size: 14px;
    color: #666;
}

.item-options {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.item-price {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.summary-totals {
    padding: 20px;
    background-color: #f8f8f8;
}

.total-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.total-line:last-child {
    margin-bottom: 0;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e5e5;
    font-size: 18px;
    font-weight: 600;
}

.total-label {
    color: #666;
}

.total-line:last-child .total-label {
    color: #333;
}

.total-amount {
    color: #333;
}

/* Order Button */
.order-button-wrapper {
    padding: 20px;
}

.order-button {
    width: 100%;
    padding: 16px;
    background-color: #ff8000;
    color: white;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.order-button:hover:not(:disabled) {
    background-color: #e67300;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 128, 0, 0.3);
}

.order-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.order-button-text {
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-button-text .icon {
    margin-right: 8px;
}

/* Comments Section */
.comments-section {
    margin-top: 20px;
}

.comments-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
}

/* Terms Checkbox */
.terms-checkbox {
    display: flex;
    align-items: flex-start;
    margin-top: 20px;
}

.terms-checkbox input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
}

.terms-checkbox label {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.terms-checkbox a {
    color: #ff8000;
    text-decoration: none;
}

.terms-checkbox a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 991px) {
    .checkout-main {
        grid-template-columns: 1fr;
    }
    
    .checkout-summary {
        position: relative;
        top: 0;
        order: -1;
        margin-bottom: 20px;
    }
}

@media (max-width: 767px) {
    /* Mobile-optimierte Checkout-Struktur */
    .checkout-container {
        padding: 0;
        /* Reduzierter Abstand unten - kein Footer auf Checkout */
        padding-bottom: 100px; /* Nur Platz für Fixed Order Button */
    }
    
    .checkout-wrapper {
        padding: 0;
    }
    
    /* Checkout Header anpassen */
    .checkout-header {
        margin-bottom: 10px;
        border-radius: 0;
        padding: 15px;
    }
    
    .checkout-steps {
        font-size: 12px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .step-divider {
        width: 30px;
    }
    
    /* Main Layout - Mobile First */
    .checkout-main {
        display: flex;
        flex-direction: column;
    }
    
    /* Forms bleiben oben */
    .checkout-forms {
        order: 1;
        border-radius: 0;
        margin-bottom: 5px; /* Reduzierter Abstand */
    }
    
    /* Summary kommt danach */
    .checkout-summary {
        order: 2;
        position: static;
        margin-bottom: 0; /* Kein zusätzlicher Abstand unten */
    }
    
    /* Order Summary Card ohne Bottom Padding */
    .order-summary-card {
        border-radius: 0;
        margin-bottom: 0;
    }
    
    /* Order Button wird fixed am Bottom */
    .order-button-wrapper {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        border-top: 1px solid #e5e5e5;
        z-index: 1000;
        border-radius: 0;
    }
    
    /* Terms Checkbox kompakter */
    .terms-checkbox {
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    .terms-checkbox label {
        font-size: 12px;
        line-height: 1.3;
    }
    
    /* Order Button größer und prominenter */
    .order-button {
        padding: 14px;
        font-size: 16px;
        border-radius: 6px;
    }
    
    /* Security Text kleiner */
    .order-button-wrapper .text-center {
        margin-top: 8px !important;
    }
    
    .order-button-wrapper .small {
        font-size: 11px;
    }
    
    /* Form Sections kompakter */
    .section-header {
        padding: 10px 15px; /* Noch kompakter */
    }
    
    .section-title {
        font-size: 16px;
    }
    
    .section-content {
        padding: 12px 15px; /* Reduziertes Padding */
    }
    
    /* Delivery Type Options vertikal */
    .delivery-type-selector {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .delivery-type-option {
        padding: 12px;
    }
    
    .delivery-type-icon {
        font-size: 24px;
        margin-bottom: 5px;
    }
    
    /* Form Fields kompakter */
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    /* Payment Methods kompakter */
    .payment-method-item {
        padding: 12px;
    }
    
    .payment-method-icon {
        width: 32px;
        height: 32px;
        font-size: 20px;
        margin-right: 12px;
    }
    
    .payment-method-name {
        font-size: 15px;
    }
    
    .payment-method-desc {
        font-size: 12px;
    }
    
    /* Summary Items kompakter */
    .summary-items {
        padding: 15px;
        max-height: none; /* Kein Scroll auf Mobile */
    }
    
    .summary-item {
        margin-bottom: 12px;
    }
    
    .item-name {
        font-size: 14px;
    }
    
    .item-quantity,
    .item-options {
        font-size: 12px;
    }
    
    /* Totals Section */
    .summary-totals {
        padding: 15px;
        margin-bottom: 10px;
    }
    
    .total-line {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .total-line:last-child {
        font-size: 16px;
        margin-top: 8px;
        padding-top: 8px;
    }
    
    /* Coupon Section kompakter */
    .summary-coupon-section {
        padding: 12px 15px;
    }
    
    .coupon-input-wrapper input {
        font-size: 14px;
        padding: 8px 10px;
    }
    
    .coupon-input-wrapper button {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    /* Tip Section anpassen */
    .tip-section {
        padding: 12px 0;
    }
    
    .tip-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .tip-btn {
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .custom-tip-btn {
        grid-column: span 3;
    }
    
    /* Comments Section */
    .comments-textarea {
        min-height: 80px;
        font-size: 14px;
        padding: 10px 12px;
    }
    
    /* Saved Addresses */
    .saved-address-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .saved-address-content {
        font-size: 14px;
    }
    
    .add-new-address-btn {
        padding: 10px;
        font-size: 14px;
    }
    
    /* Time Options */
    .time-option-row {
        grid-template-columns: 1fr;
    }
    
    .time-option {
        padding: 10px;
    }
    
    .time-option-content {
        font-size: 14px;
    }
    
    .time-option-content i {
        font-size: 16px;
    }
    
    /* Summary zuerst für bessere Mobile UX */
    .checkout-main {
        display: flex;
        flex-direction: column;
    }
    
    /* Summary oben anzeigen auf Mobile */
    .checkout-summary {
        order: 0;
        margin-bottom: 10px;
    }
    
    /* Forms danach */
    .checkout-forms {
        order: 1;
    }
    
    /* Summary Header prominenter */
    .summary-header {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    /* Restaurant Info kompakter */
    .summary-restaurant {
        padding: 12px 15px;
    }
    
    .restaurant-name {
        font-size: 15px;
    }
    
    .restaurant-info {
        font-size: 13px;
    }
}

/* Loading States */
.section-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.section-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff8000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Success Animation */
.success-checkmark {
    color: #00a74a;
    font-size: 20px;
    animation: checkmark 0.4s ease-in-out;
}

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Coupon Section in Summary */
.summary-coupon-section {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.coupon-input-wrapper {
    display: flex;
    gap: 8px;
}

.coupon-input-wrapper input {
    flex: 1;
}

.applied-coupon-item {
    background-color: #e8f5e9;
    padding: 8px 12px;
    border-radius: 4px;
}

/* Tip Section */
.tip-section {
    padding: 15px 0;
    border-top: 1px solid #e5e5e5;
}

.tip-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.tip-btn {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    background-color: #fff;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.tip-btn:hover {
    border-color: #ff8000;
}

.tip-btn.active {
    background-color: #ff8000;
    color: white;
    border-color: #ff8000;
}

.custom-tip-input input {
    width: 100%;
}

/* Delivery Time Styles */
.delivery-time-options {
    border-top: 1px solid #e5e5e5;
    padding-top: 20px;
}

.time-option-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.time-option {
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.time-option:hover {
    border-color: #ff8000;
}

.time-option.active {
    border-color: #ff8000;
    background-color: #fff5e5;
}

.time-option-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    color: #333;
}

.time-option-content i {
    color: #ff8000;
    font-size: 18px;
}

.scheduled-time-fields {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

@media (max-width: 767px) {
    .time-option-row {
        grid-template-columns: 1fr;
    }
}