/* ===================================
   CHECKOUT PAGE - WARM ORGANIC STYLE
=================================== */

/* Page Background */
.checkout-page {
    background: var(--color-beige);
    min-height: 100vh;
}

/* Header */
.checkout-header {
    background: var(--color-white);
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
}

.checkout-header .logo-img {
    height: 80px;
}

.secure-checkout-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.9rem;
}

.secure-checkout-badge svg {
    width: 18px;
    height: 18px;
}

/* Layout */
.checkout-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 40px;
    padding: 40px 0 60px;
    align-items: start;
}

.checkout-forms {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Form Sections */
.form-section {
    background: var(--color-white);
    padding: 32px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.form-section-title h2 {
    font-size: 1.25rem;
    margin: 0;
}

.step-badge {
    background: var(--color-teal);
    color: var(--color-white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Package Selector */
.package-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.package-radio-label {
    display: block;
    cursor: pointer;
    position: relative;
}

.package-radio-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.package-radio-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: var(--color-white);
}

.package-radio-card:hover {
    border-color: var(--color-teal);
}

.package-radio-input:checked + .package-radio-card {
    border-color: var(--color-teal);
    background: var(--color-teal-light);
}

.package-info h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.package-savings {
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.85rem;
    margin: 0;
}

.package-shipping-fee {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    margin: 0;
}

.package-price-wrap {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 12px;
}

.package-price {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-text);
}

.radio-check-icon {
    color: var(--color-teal);
    opacity: 0;
    transition: var(--transition);
    width: 24px;
    height: 24px;
}

.package-radio-input:checked + .package-radio-card .radio-check-icon {
    opacity: 1;
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    transition: var(--transition);
    background: var(--color-white);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-teal);
    box-shadow: 0 0 0 3px var(--color-teal-light);
}

.form-input::placeholder {
    color: var(--color-text-light);
}

/* Select Wrapper */
.select-wrapper {
    position: relative;
}

.form-select {
    appearance: none;
    padding-right: 44px;
    cursor: pointer;
}

.select-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--color-text-secondary);
    pointer-events: none;
}

/* Form Divider */
.form-divider {
    height: 1px;
    background: var(--color-border);
    margin: 28px 0;
}

/* ===================================
   CUSTOM SELECT WITH SEARCH
=================================== */

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-white);
    cursor: pointer;
    transition: var(--transition);
}

.custom-select-trigger:hover {
    border-color: var(--color-teal);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--color-teal);
    box-shadow: 0 0 0 3px var(--color-teal-light);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select-value {
    font-size: 1rem;
    color: var(--color-text);
}

.custom-select-value.placeholder {
    color: var(--color-text-light);
}

.custom-select-icon {
    width: 20px;
    height: 20px;
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
}

.custom-select.open .custom-select-icon {
    transform: rotate(180deg);
    color: var(--color-teal);
}

/* Dropdown */
.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-teal);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: 0 8px 24px rgba(61, 50, 41, 0.12);
    z-index: 100;
    display: none;
    max-height: 320px;
    overflow: hidden;
}

.custom-select.open .custom-select-dropdown {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Input */
.custom-select-search {
    position: relative;
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-cream);
}

.custom-select-search-input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-text);
    background: var(--color-white);
    transition: var(--transition);
}

.custom-select-search-input:focus {
    outline: none;
    border-color: var(--color-teal);
}

.custom-select-search-input::placeholder {
    color: var(--color-text-light);
}

.custom-select-search .search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--color-text-light);
    pointer-events: none;
}

/* Options List */
.custom-select-options {
    max-height: 240px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: var(--color-cream);
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

.custom-select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-select-option:hover {
    background: var(--color-cream);
}

.custom-select-option.selected {
    background: var(--color-teal-light);
    color: var(--color-teal);
    font-weight: 600;
}

.custom-select-option.selected::after {
    content: '';
    margin-left: auto;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23009688' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.custom-select-option.hidden {
    display: none;
}

.custom-select-no-results {
    padding: 16px;
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* ===================================
   TERMS AGREEMENT CHECKBOX
=================================== */

.terms-agreement {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    position: relative;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-white);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--color-teal);
    border-color: var(--color-teal);
}

.checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    opacity: 1;
}

.checkbox-label:hover .checkbox-custom {
    border-color: var(--color-teal);
}

.checkbox-text {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.terms-link {
    color: var(--color-teal);
    text-decoration: underline;
    font-weight: 600;
}

.terms-link:hover {
    color: #00796B;
}

.terms-note {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 8px;
    margin-left: 34px;
    margin-bottom: 0;
}

.terms-agreement.error .checkbox-custom {
    border-color: #D86050;
}

.terms-agreement.error .terms-note {
    color: #D86050;
}

/* ===================================
   MODAL STYLES
=================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(61, 50, 41, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--color-white);
    border-radius: var(--border-radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(61, 50, 41, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.375rem;
    margin: 0;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--color-cream);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--color-beige);
}

.modal-close svg {
    width: 20px;
    height: 20px;
    color: var(--color-text-secondary);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--color-cream);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.modal-updated {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 24px;
    font-style: italic;
}

.modal-body h3 {
    font-size: 1.1rem;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--color-text);
}

.modal-body h3:first-of-type {
    margin-top: 0;
}

.modal-body p {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 12px;
}

.modal-body ul {
    margin: 12px 0;
    padding-left: 20px;
}

.modal-body ul li {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 8px;
    position: relative;
    padding-left: 8px;
}

.modal-body ul li::before {
    content: '•';
    position: absolute;
    left: -12px;
    color: var(--color-teal);
}

.modal-acceptance {
    background: var(--color-cream);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 24px;
}

.modal-acceptance p {
    margin: 0;
    font-size: 0.9rem;
}

/* Shipping Table */
.shipping-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.9rem;
}

.shipping-table th,
.shipping-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.shipping-table th {
    background: var(--color-cream);
    font-weight: 600;
    color: var(--color-text);
}

.shipping-table tr:last-child td {
    border-bottom: none;
}

.shipping-table tr:hover td {
    background: var(--color-cream);
}

/* Shipping Notice */
.shipping-notice {
    background: #FEF3E7;
    border: 1px solid #E07A5F;
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 20px 0;
}

.shipping-notice h4 {
    color: #C96A52;
    margin: 0 0 12px 0;
    font-size: 1rem;
}

.shipping-notice p {
    margin-bottom: 12px;
}

.shipping-notice ul {
    margin-bottom: 0;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 200px;
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal {
        max-height: 90vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .shipping-table {
        font-size: 0.8rem;
    }
    
    .shipping-table th,
    .shipping-table td {
        padding: 8px 12px;
    }
}

/* Order Summary Sidebar */
.order-summary-sidebar {
    position: sticky;
    top: 100px;
}

.summary-card {
    background: var(--color-white);
    padding: 28px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
}

.summary-title {
    font-size: 1.25rem;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.summary-product {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}

.summary-product-img {
    width: 80px;
    height: auto;
    border-radius: var(--border-radius);
    object-fit: cover;
}

.summary-product-info h4 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.summary-product-price {
    font-weight: 700;
    color: var(--color-teal);
    font-size: 1.1rem;
}

.summary-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

.summary-row.total {
    font-weight: 700;
    color: var(--color-text);
    font-size: 1.15rem;
    border-top: 2px solid var(--color-border);
    padding-top: 16px;
    margin-top: 8px;
}

.shipping-free {
    color: var(--color-success);
    font-weight: 600;
}

.submit-btn {
    margin-top: 24px;
    padding: 18px 24px;
    font-size: 1.1rem;
}

.submit-btn svg {
    width: 20px;
    height: 20px;
}

.secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.secure-note svg {
    width: 16px;
    height: 16px;
    color: var(--color-teal);
}

/* Footer */
.checkout-footer {
    text-align: center;
    padding: 30px 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    background: var(--color-beige);
}

.checkout-footer a {
    color: var(--color-teal);
}

.checkout-footer a:hover {
    text-decoration: underline;
}

/* ===================================
   RESPONSIVE
=================================== */

@media (max-width: 1024px) {
    .checkout-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .order-summary-sidebar {
        position: static;
        order: -1;
    }
    
    .checkout-header .logo-img {
        height: 60px;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-section {
        padding: 24px;
    }
    
    .package-radio-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .package-price-wrap {
        width: 100%;
        justify-content: space-between;
    }
    
    .checkout-header .logo-img {
        height: 50px;
    }
}

@media (max-width: 480px) {
    .checkout-layout {
        padding: 24px 0 40px;
    }
    
    .form-section {
        padding: 20px;
    }
    
    .summary-card {
        padding: 20px;
    }
    
    .package-price {
        font-size: 1.25rem;
    }
}
