/**
 * Checkout Page Styles
 * Uses theme rem sizing (1rem = 10px due to html { font-size: 62.5% })
 */

/* ========================================
   Checkout Button Overrides
   Consistent sizing matching theme
   ======================================== */

.checkout-section .btn,
.checkout-success-section .btn {
    font-size: 1.4rem;
    padding: 1.2rem 2.4rem;
}

.checkout-section .btn-sm {
    font-size: 1.3rem;
    padding: 0.8rem 1.6rem;
}

.checkout-section .btn-lg,
.checkout-section #btn-place-order {
    font-size: 1.5rem;
    padding: 1.4rem 2.8rem;
    font-weight: 600;
    width: 100%;
}

.checkout-section .btn-outline.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.checkout-section .btn-outline.btn-sm:hover {
    background: var(--color-primary);
    color: #fff;
}

/* Checkout Layout */
.checkout-section {
    padding: 2rem 0 4rem;
    background: #f8f9fa;
    min-height: 80vh;
}

.checkout-title {
    font-size: 2.4rem;
    font-weight: 600;
    margin: 0 0 2rem;
    color: var(--color-text);
}

.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 991px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .checkout-sidebar {
        order: -1;
    }
}

/* Checkout Cards */
.checkout-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.checkout-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}

.checkout-card-header h2 {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0;
}

.checkout-step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: 600;
}

.checkout-card-header-collapsible {
    cursor: pointer;
    user-select: none;
}

.checkout-card-header-collapsible:hover {
    background: #f9f9f9;
}

.toggle-icon {
    transition: transform 0.2s ease;
}

.checkout-card-header-collapsible.open .toggle-icon {
    transform: rotate(180deg);
}

.checkout-card-body {
    padding: 1.5rem;
}

/* Address Selection */
.no-addresses {
    text-align: center;
    padding: 2.5rem;
}

.no-addresses p {
    font-size: 1.4rem;
    margin: 0 0 1.5rem;
    color: var(--color-text-light);
}

.address-selection {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.address-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.address-option:hover {
    border-color: #d1d5db;
}

.address-option.selected,
.address-option:has(input:checked) {
    border-color: var(--color-primary);
    background: #f9f6f3;
}

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

.address-option-content {
    flex: 1;
}

.address-option-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.address-option-name {
    font-weight: 600;
    font-size: 1.5rem;
}

.address-option-line {
    font-size: 1.4rem;
    color: var(--color-text);
    margin: 0 0 0.4rem;
    line-height: 1.5;
}

.address-option-phone {
    font-size: 1.3rem;
    color: var(--color-text-light);
    margin: 0.6rem 0 0;
}

.address-option-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    color: transparent;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.address-option.selected .address-option-check,
.address-option:has(input:checked) .address-option-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* Edit Address Button */
.btn-edit-address {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    margin-top: 0.8rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit-address:hover {
    background: var(--color-primary);
    color: #fff;
}

.btn-edit-address svg {
    width: 14px;
    height: 14px;
}

/* Payment Options */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.payment-option:hover {
    border-color: #d1d5db;
}

.payment-option.selected,
.payment-option:has(input:checked) {
    border-color: var(--color-primary);
    background: #f9f6f3;
}

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

.payment-option-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.payment-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 32px;
    background: #f5f5f5;
    border-radius: 4px;
    color: var(--color-text);
}

.payment-option-icon.upi-icon {
    font-size: 1.2rem;
    font-weight: 700;
    color: #5f259f;
}

.payment-option-info {
    display: flex;
    flex-direction: column;
}

.payment-option-name {
    font-weight: 600;
    font-size: 1.5rem;
}

.payment-option-desc {
    font-size: 1.3rem;
    color: var(--color-text-light);
}

.payment-option-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    color: transparent;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.payment-option.selected .payment-option-check,
.payment-option:has(input:checked) .payment-option-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* Disabled Payment Option */
.payment-option-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f5;
}

.payment-option-disabled:hover {
    border-color: #e5e7eb;
}

.payment-option-disabled .payment-option-icon {
    opacity: 0.5;
}

.payment-option-unavailable {
    color: #dc2626 !important;
    font-size: 1.2rem !important;
}

/* Checkout Items */
.checkout-items-body {
    max-height: 400px;
    overflow-y: auto;
}

.checkout-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.checkout-item-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.checkout-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

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

.checkout-item-name {
    font-size: 1.4rem;
    font-weight: 500;
    margin: 0 0 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkout-item-meta {
    font-size: 1.3rem;
    color: var(--color-text-light);
    margin: 0;
}

.checkout-item-total {
    font-size: 1.4rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Checkout Summary Sidebar */
.checkout-sidebar {
    position: sticky;
    top: 100px;
}

.checkout-summary {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1.5rem;
}

.checkout-summary-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 1.5rem;
}

.checkout-summary-rows {
    margin-bottom: 1.5rem;
}

.checkout-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    font-size: 1.4rem;
}

.checkout-summary-total {
    border-top: 1px solid #e5e5e5;
    margin-top: 0.6rem;
    padding-top: 1.2rem;
    font-size: 1.6rem;
    font-weight: 600;
}

.text-success {
    color: #059669;
}

.checkout-terms {
    font-size: 1.2rem;
    color: var(--color-text-light);
    text-align: center;
    margin: 1.5rem 0 0;
    line-height: 1.6;
}

.checkout-terms a {
    color: var(--color-primary);
}

/* Address Type Badge (same as account) */
.address-type-badge {
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    background: #e5e5e5;
    color: var(--color-text);
}

.address-type-badge.residential {
    background: #e0f2fe;
    color: #0369a1;
}

.address-type-badge.commercial {
    background: #fef3c7;
    color: #92400e;
}

/* ========================================
   Checkout Success Page
   ======================================== */

.checkout-success-section {
    padding: 3rem 0 4rem;
    background: #f8f9fa;
}

.success-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background: #d1fae5;
    border-radius: 50%;
    margin-bottom: 1.5rem;
}

.success-icon svg {
    color: #059669;
}

.success-title {
    font-size: 2.8rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--color-text);
}

.success-message {
    font-size: 1.5rem;
    color: var(--color-text-light);
    margin: 0 0 2.5rem;
}

.success-order-info {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.success-order-number,
.success-order-total {
    text-align: center;
}

.success-order-number .label,
.success-order-total .label {
    display: block;
    font-size: 1.3rem;
    color: var(--color-text-light);
    margin-bottom: 0.4rem;
}

.success-order-number .value,
.success-order-total .value {
    display: block;
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--color-text);
}

/* Success Summary Card */
.success-summary-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1.5rem;
    text-align: left;
    margin-bottom: 2rem;
}

.success-summary-card h3 {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0 0 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e5e5;
}

.success-items {
    margin-bottom: 1rem;
}

.success-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.success-item-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.success-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.success-item-details {
    flex: 1;
}

.success-item-name {
    display: block;
    font-weight: 500;
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
}

.success-item-qty {
    font-size: 1.3rem;
    color: var(--color-text-light);
}

.success-item-price {
    font-size: 1.4rem;
    font-weight: 600;
}

.success-totals {
    padding: 1rem 0;
    border-top: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 1rem;
}

.success-total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 1.4rem;
}

.success-total-row.total {
    font-weight: 600;
    font-size: 1.6rem;
    padding-top: 1rem;
    margin-top: 0.6rem;
    border-top: 1px solid #e5e5e5;
}

.success-delivery,
.success-payment {
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.success-delivery:last-child,
.success-payment:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.success-delivery h4,
.success-payment h4 {
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-light);
    margin: 0 0 0.6rem;
}

.delivery-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.4rem;
}

.delivery-address,
.delivery-phone {
    font-size: 1.4rem;
    color: var(--color-text);
    margin: 0 0 0.4rem;
    line-height: 1.6;
}

.success-payment p {
    font-size: 1.4rem;
    margin: 0;
}

/* Success Actions */
.success-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.success-help {
    font-size: 1.3rem;
    color: var(--color-text-light);
}

.success-help a {
    color: var(--color-primary);
}

/* Modal (same as account) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-lg {
    max-width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}

.modal-header h3 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.2rem;
    height: 3.2rem;
    border: none;
    background: transparent;
    font-size: 2.2rem;
    color: var(--color-text-light);
    cursor: pointer;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f0f0f0;
    color: var(--color-text);
}

.modal-body {
    padding: 1.5rem;
}

/* Form Styles (scoped to checkout/modal) */
.checkout-section .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 575px) {
    .checkout-section .form-row {
        grid-template-columns: 1fr;
    }
}

.checkout-section .form-group {
    margin-bottom: 1rem;
}

.checkout-section .form-label {
    display: block;
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 0.6rem;
    color: var(--color-text);
}

.checkout-section .form-label .required {
    color: #dc3545;
}

.checkout-section .form-input,
.modal input[type="text"],
.modal input[type="tel"],
.modal input[type="email"],
.modal input[type="number"],
.modal input[type="password"],
.modal select,
.modal textarea {
    width: 100%;
    padding: 1rem 1.2rem;
    font-size: 1.4rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background: #fff;
    transition: all 0.2s ease;
}

.checkout-section .form-input:focus,
.modal input[type="text"]:focus,
.modal input[type="tel"]:focus,
.modal input[type="email"]:focus,
.modal input[type="number"]:focus,
.modal input[type="password"]:focus,
.modal select:focus,
.modal textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.checkout-section .form-select,
.modal select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    padding-right: 3.5rem;
    cursor: pointer;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e5e5;
}

/* Modal Button Overrides */
.modal .btn {
    font-size: 1.4rem;
    padding: 1rem 2rem;
}

.modal .btn-outline {
    color: var(--color-text);
    border-color: #d1d5db;
}

.modal .btn-outline:hover {
    background: #f3f4f6;
    color: var(--color-text);
    border-color: #d1d5db;
}

/* Notification Styles */
.checkout-notification {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
}

.checkout-notification-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.checkout-notification-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* UPI Payment Modal */
.modal-md {
    max-width: 500px;
}

.upi-modal-body {
    text-align: center;
}

.upi-qr-section {
    padding: 1.5rem 0;
}

.upi-qr-image {
    width: 250px;
    height: 250px;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    margin: 0 auto 1.5rem;
    display: block;
}

.upi-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 0.5rem;
}

.upi-timer {
    font-size: 1.4rem;
    color: #dc2626;
    font-weight: 500;
    margin: 0;
}

.upi-instructions {
    text-align: left;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.upi-instructions h4 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.upi-instructions ol {
    margin: 0;
    padding-left: 1.5rem;
}

.upi-instructions li {
    font-size: 1.4rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.upi-actions {
    padding-top: 1rem;
}

.upi-actions .btn {
    min-width: 200px;
}
