/* Modern Checkout Form Styles */

.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group-modern {
    position: relative;
    /* Margin removed; relying on flex gap for better balance */
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.2rem;
    z-index: 2;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* Fix icon position for textarea */
.modern-textarea~.input-icon {
    top: 20px;
    transform: none;
}

.modern-input {
    width: 100%;
    padding: 18px 50px 18px 20px;
    border: 2px solid rgba(var(--primary-rgb, 255, 107, 53), 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-main, 'Segoe UI', sans-serif);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.modern-input:focus {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb, 255, 107, 53), 0.05);
    box-shadow: 0 0 20px rgba(var(--primary-rgb, 255, 107, 53), 0.15),
        0 0 0 4px rgba(var(--primary-rgb, 255, 107, 53), 0.1);
}

.modern-input:focus+.floating-label,
.modern-input:not(:placeholder-shown)+.floating-label {
    top: -10px;
    right: 12px;
    font-size: 0.75rem;
    background: var(--glass-bg, rgba(255, 255, 255, 0.9));
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--primary-color);
    font-weight: 600;
}

.modern-textarea {
    resize: vertical;
    min-height: 100px;
    padding-top: 15px;
}

.floating-label {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #6c757d);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    z-index: 1;
}

.helper-text {
    display: flex;
    align-items: center;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.8;
    background: rgba(var(--primary-rgb, 255, 107, 53), 0.08);
    padding: 6px 12px;
    border-radius: 8px;
    width: fit-content;
    border: 1px solid rgba(var(--primary-rgb, 255, 107, 53), 0.1);
}

.helper-text i {
    margin-left: 8px;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.checkout-confirm-btn {
    margin-top: 30px;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(var(--primary-rgb, 255, 107, 53), 0.4);
    transform: translateY(0);
    transition: all 0.3s ease;
}

.checkout-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(var(--primary-rgb, 255, 107, 53), 0.5);
}

.checkout-confirm-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb, 255, 107, 53), 0.3);
}

.checkout-security {
    font-size: 0.9rem;
    margin-top: 15px;
}

.checkout-security i {
    color: var(--success-color, #10b981);
    margin-left: 5px;
}

/* Checkout Summary Styles */
.checkout-summary-card {
    background: linear-gradient(135deg, rgba(var(--primary-rgb, 255, 107, 53), 0.05), rgba(var(--secondary-rgb, 0, 78, 137), 0.05));
    border: 2px solid rgba(var(--primary-rgb, 255, 107, 53), 0.2);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.checkout-delivery-fee {
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.delivery-fee-label {
    color: var(--text-secondary);
}

.delivery-fee-amount {
    font-weight: 600;
}

.checkout-total-section {
    padding-top: 15px;
    border-top: 2px solid rgba(var(--primary-rgb, 255, 107, 53), 0.3);
    margin-top: 10px;
}

.checkout-total-value {
    color: var(--success-color);
    font-weight: 800;
}

/* Dark mode adjustments */
body.dark-mode .modern-input {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    border-color: rgba(var(--primary-rgb, 255, 107, 53), 0.3);
}

body.dark-mode .modern-input:focus {
    background: rgba(0, 0, 0, 0.3);
}

body.dark-mode .floating-label:not(:focus) {
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .checkout-form {
        gap: 18px;
    }

    .modern-input {
        padding: 14px 42px 14px 15px;
        font-size: 0.9rem;
    }

    .modern-textarea {
        min-height: 80px;
        padding-top: 12px;
    }

    .input-icon {
        right: 10px;
        font-size: 1rem;
    }

    .floating-label {
        right: 42px;
        font-size: 0.9rem;
    }

    .modern-input:focus+.floating-label,
    .modern-input:not(:placeholder-shown)+.floating-label {
        top: -8px;
        right: 10px;
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    .helper-text {
        font-size: 0.75rem;
        margin-top: 6px;
    }

    .checkout-confirm-btn {
        padding: 14px;
        font-size: 0.95rem;
        margin-top: 20px;
    }

    .checkout-security {
        font-size: 0.8rem;
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    .checkout-form {
        gap: 15px;
    }

    .modern-input {
        padding: 12px 38px 12px 12px;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    .modern-textarea {
        min-height: 70px;
        padding-top: 10px;
    }

    .input-icon {
        right: 8px;
        font-size: 0.9rem;
    }

    .floating-label {
        right: 38px;
        font-size: 0.85rem;
    }

    .modern-input:focus+.floating-label,
    .modern-input:not(:placeholder-shown)+.floating-label {
        top: -7px;
        right: 8px;
        font-size: 0.65rem;
        padding: 1px 5px;
    }

    .helper-text {
        font-size: 0.7rem;
        margin-top: 5px;
    }

    .checkout-confirm-btn {
        padding: 12px;
        font-size: 0.9rem;
        margin-top: 15px;
    }

    .checkout-security {
        font-size: 0.75rem;
        margin-top: 10px;
    }

    /* تصغير عنوان القسم */
    #checkoutPage h3 {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    /* تصغير ملخص الطلب */
    .checkout-summary-card {
        padding: 15px;
        margin-bottom: 20px;
    }

    .checkout-item {
        padding: 8px 0;
        font-size: 0.85rem;
    }

    .checkout-total-section {
        padding-top: 12px;
        margin-top: 8px;
    }
}

@media (max-width: 360px) {
    .modern-input {
        padding: 10px 35px 10px 10px;
        font-size: 0.8rem;
    }

    .input-icon {
        right: 6px;
        font-size: 0.85rem;
    }

    .floating-label {
        right: 35px;
        font-size: 0.8rem;
    }

    .modern-input:focus+.floating-label,
    .modern-input:not(:placeholder-shown)+.floating-label {
        font-size: 0.6rem;
    }

    .checkout-confirm-btn {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Checkout Page specific styles */
.checkout-history-btn {
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: 14px;
    /* Consistent with glass-card */
    transition: all 0.3s ease;
}

.checkout-history-btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
    transform: translateY(-2px);
}

.checkout-history-icon-box {
    background: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.checkout-history-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.checkout-history-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.checkout-history-arrow {
    font-size: 0.9rem;
    color: var(--text-secondary);
}