/* checkout-styles.css - สไตล์สำหรับหน้าชำระเงิน */

.checkout-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ขั้นตอนการชำระเงิน */
.checkout-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    grid-column: 1 / -1;
}

.step {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
}

.step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: calc(100% - 60px);
    height: 2px;
    background-color: #eee;
    transform: translateY(-50%);
    z-index: 1;
}

.step.active:not(:last-child)::after {
    background-color: #FF8C00;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #eee;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    z-index: 2;
}

.step.active .step-number {
    background-color: #FF8C00;
    color: white;
}

.step-title {
    font-weight: 600;
    color: #888;
}

.step.active .step-title {
    color: #333;
}

/* ฟอร์มชำระเงิน */
.checkout-form-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.checkout-step-content {
    display: none;
}

.checkout-step-content.active {
    display: block;
}

.checkout-step-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* เลือกที่อยู่จัดส่ง */
.address-selection {
    margin-bottom: 20px;
}

.loading-addresses {
    text-align: center;
    padding: 20px;
    color: #888;
}

.address-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.address-card.selected {
    border-color: #FF8C00;
    background-color: #FFF8F0;
}

.address-card.default .address-name::after {
    content: "ที่อยู่หลัก";
    margin-left: 10px;
    font-size: 12px;
    color: white;
    background-color: #28a745;
    padding: 2px 8px;
    border-radius: 4px;
}

.address-card h4 {
    margin-top: 0;
    margin-bottom: 5px;
}

.address-card p {
    margin: 5px 0;
    color: #555;
}

.address-card .edit-button {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #888;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.address-card .edit-button:hover {
    color: #FF8C00;
}

/* วิธีการจัดส่ง */
.shipping-method-summary {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.selected-shipping-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.shipping-method-name {
    font-weight: 600;
}

.shipping-method-price {
    color: #FF8C00;
    font-weight: 600;
}

.change-shipping-btn {
    color: #FF8C00;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
}

.change-shipping-btn:hover {
    text-decoration: underline;
}

/* วิธีการชำระเงิน */
.payment-methods {
    margin-bottom: 20px;
}

.payment-method {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.payment-method:hover {
    background-color: #f9f9f9;
}

.payment-method input[type="radio"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
}

.payment-method label {
    display: flex;
    align-items: center;
    flex: 1;
    cursor: pointer;
}

.payment-icon {
    margin-right: 15px;
    font-size: 24px;
    color: #555;
    width: 40px;
    text-align: center;
}

.payment-info {
    flex: 1;
}

.payment-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.payment-description {
    font-size: 14px;
    color: #777;
}

.payment-method.selected {
    border-color: #FF8C00;
    background-color: #FFF8F0;
}

/* รายละเอียดการชำระเงิน */
.payment-details {
    margin-top: 20px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.payment-details-content {
    display: none;
}

.payment-details-content.active {
    display: block;
}

.bank-accounts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.bank-account {
    display: flex;
    align-items: center;
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.bank-logo {
    width: 60px;
    margin-right: 15px;
}

.bank-logo img {
    width: 100%;
    height: auto;
}

.bank-info p {
    margin: 5px 0;
    color: #555;
}

.payment-note {
    font-size: 14px;
    color: #777;
    padding: 10px;
    border-left: 3px solid #FF8C00;
    background-color: #FFF8F0;
}

/* ยืนยันการสั่งซื้อ */
.order-summary {
    margin-bottom: 30px;
}

.order-summary h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

.order-items {
    margin-bottom: 20px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.order-item-info {
    display: flex;
}

.order-item-image {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-item-image img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.order-item-details {
    flex: 1;
}

.order-item-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.order-item-price {
    color: #777;
    font-size: 14px;
}

.order-item-quantity {
    color: #555;
}

.order-item-total {
    font-weight: 600;
    color: #FF8C00;
}

.order-totals {
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.order-total-row.grand-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-weight: bold;
    font-size: 18px;
}

/* ข้อมูลการจัดส่งและชำระเงิน */
.order-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.delivery-info, .payment-info {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
}

.delivery-info h4, .payment-info h4 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.confirm-address, .confirm-shipping, .confirm-payment {
    color: #555;
}

.confirm-address p, .confirm-shipping p, .confirm-payment p {
    margin: 5px 0;
}

.terms-agreement {
    margin: 20px 0;
    padding: 15px;
    background-color: #FFF8F0;
    border-radius: 8px;
    border-left: 3px solid #FF8C00;
}

.terms-agreement a {
    color: #FF8C00;
    text-decoration: none;
}

.terms-agreement a:hover {
    text-decoration: underline;
}

/* สรุปคำสั่งซื้อด้านข้าง */
.order-summary-sidebar {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    align-self: flex-start;
    position: sticky;
    top: 20px;
}

.order-summary-sidebar h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.sidebar-items {
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.sidebar-item-image {
    width: 50px;
    height: 50px;
    margin-right: 10px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-item-image img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.sidebar-item-details {
    flex: 1;
}

.sidebar-item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-item-price {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #777;
}

.sidebar-totals {
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.sidebar-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.sidebar-total-row.grand-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-weight: bold;
    font-size: 16px;
}

/* ปุ่มกระทำการ */
.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.btn {
    padding: 12px 20px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    border: none;
}

.primary-btn {
    background-color: #FF8C00;
    color: white;
}

.primary-btn:hover {
    background-color: #E67E00;
}

.secondary-btn {
    background-color: #f5f5f5;
    color: #555;
}

.secondary-btn:hover {
    background-color: #e5e5e5;
}

/* โมดัลสำหรับเพิ่ม/แก้ไขที่อยู่ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    color: #888;
    cursor: pointer;
}

.close-modal:hover {
    color: #FF8C00;
}

.address-form {
    margin-top: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Responsive Design */
@media screen and (max-width: 992px) {
    .checkout-container {
        grid-template-columns: 1fr;
    }
    
    .order-summary-sidebar {
        position: static;
        margin-top: 20px;
    }
    
    .order-details {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 768px) {
    .checkout-steps {
        flex-direction: column;
        margin-bottom: 20px;
    }
    
    .step {
        margin-bottom: 10px;
    }
    
    .step:not(:last-child)::after {
        display: none;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions button, .form-actions a {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
/* เพิ่มสำหรับการเน้นการยอมรับเงื่อนไข */
.terms-agreement.highlight-error {
    background-color: #ffebee;
    border-left: 3px solid #f44336;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    70% {
        box-shadow: 0 0 0 5px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}