/* Cart Page Styles */

.cart-page {
    padding: 5rem 0;
    min-height: 80vh;
}

.page-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 5rem 0;
    display: none; /* 기본적으로 숨김 */
}

.empty-cart.show {
    display: block !important;
}

.empty-cart svg {
    stroke-width: 1;
    opacity: 0.3;
    margin-bottom: 2rem;
}

.empty-cart h2 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.empty-cart p {
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

/* Cart Content */
.cart-content {
    display: none; /* 기본적으로 숨김 */
}

.cart-content.show {
    display: block !important;
}

/* Cart Grid */
.cart-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
}

/* Cart Items */
.cart-items {
    order: 2;
}

.cart-items h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin-bottom: 0;
}

.item-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: normal;
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.cart-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.cart-item-size {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.change-option-btn {
    padding: 0.3rem 0.8rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.change-option-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 삭제 버튼 및 옵션 버튼 정렬 */
.cart-item-info button {
    white-space: nowrap;
}

.cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
}

.quantity-btn:hover {
    background: var(--bg-light);
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: none;
    font-size: 0.9rem;
}

.remove-btn {
    background: none;
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.remove-btn:hover {
    background: var(--error-color);
    color: white;
}

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

.cart-item-price {
    text-align: right;
}

.cart-item-price .price {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.continue-shopping {
    display: inline-block;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.continue-shopping:hover {
    color: var(--primary-color);
}

/* Order Form */
.order-form {
    background: white;
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 8px;
    position: sticky;
    top: 80px;
    height: fit-content;
    order: 1;
}

.order-form h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button input {
    flex: 1;
}

.input-with-button .btn {
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
}

/* Order Summary */
.order-summary {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Hide mobile-first on desktop */
.mobile-first {
    display: none;
}

/* Show desktop-only on desktop */
.desktop-only {
    display: block;
}

.order-summary h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.summary-row.total {
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 0.5rem;
    font-weight: 600;
    font-size: 1.2rem;
}

/* Payment Info */
.payment-info {
    background: #fff3cd;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #ffeeba;
}

.payment-info h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.bank-info p {
    margin: 0.5rem 0;
}

.bank-info .important {
    color: var(--error-color);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Agreement */
.agreement {
    margin-bottom: 1.5rem;
}

.agreement label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Captcha */
.captcha-section {
    margin-bottom: 1.5rem;
}

.captcha {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.5rem;
}

#captcha-question {
    background: white;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-weight: 500;
}

#captcha-answer {
    flex: 1;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

/* Success Modal */
.order-success-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--success-color);
}

.modal-content p {
    margin-bottom: 0.5rem;
}

.modal-content .bank-info {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    text-align: left;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Size Change Modal Styles */
.size-change-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.size-change-modal .modal-content {
    background: white;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.size-change-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.size-change-modal .modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.size-change-modal .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.size-change-modal .modal-body {
    padding: 1.5rem;
}

.size-change-modal .size-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.size-change-modal .size-option {
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
    border-radius: 4px;
}

.size-change-modal .size-option:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.size-change-modal .size-option.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.size-change-modal .size-option.current {
    background: var(--bg-light);
    color: #999;
    cursor: not-allowed;
    border-color: var(--border-color);
}

.size-change-modal .size-option.out-of-stock {
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
    border-color: #e0e0e0;
    position: relative;
}

.size-change-modal .size-option.out-of-stock:hover {
    border-color: #e0e0e0;
    color: #ccc;
}

.size-change-modal .size-option small {
    display: block;
    font-size: 0.7rem;
    margin-top: 0.2rem;
    line-height: 1;
}

.size-change-modal .modal-footer {
    display: flex;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

/* Responsive Design - Enhanced Mobile Layout */
@media (max-width: 768px) {
    /* Show mobile-first on mobile */
    .mobile-first {
        display: block;
        order: -1; /* 가장 위로 */
        margin-bottom: 1.5rem;
        background: #f8f9fa;
        border: 2px solid var(--primary-color);
    }
    
    /* Hide desktop-only on mobile */
    .desktop-only {
        display: none;
    }
    
    .cart-page {
        padding: 1rem 0;
    }
    
    .page-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }
    
    .cart-grid {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }
    
    /* Mobile: 주문상품이 위로, 주문정보가 아래로 */
    .cart-items {
        order: 1;
    }
    
    .order-form {
        order: 2;
        position: static;
    }
    
    /* Cart Item Mobile Design */
    .cart-item {
        display: flex;
        flex-direction: column;
        padding: 1rem;
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .cart-item-image {
        width: 100%;
        height: 200px;
        object-fit: cover;
        border-radius: 8px;
        margin-bottom: 1rem;
    }
    
    .cart-item-details {
        gap: 0.5rem;
    }
    
    .cart-item-name {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .cart-item-info {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .cart-item-size {
        font-size: 0.85rem;
    }
    
    .change-option-btn {
        padding: 0.25rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .cart-item-bottom {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }
    
    .quantity-controls {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        background: var(--bg-light);
        border-radius: 25px;
        padding: 0.25rem;
    }
    
    .quantity-btn {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: white;
        border: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 1rem;
    }
    
    .quantity-btn:active {
        transform: scale(0.9);
        background: var(--primary-color);
        color: white;
    }
    
    .quantity-input {
        width: 40px;
        font-size: 0.9rem;
        background: transparent;
    }
    
    .cart-item-price .price {
        font-size: 1.1rem;
    }
    
    .remove-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .remove-btn svg {
        width: 12px;
        height: 12px;
    }
    
    /* Order Form Mobile */
    .order-form {
        padding: 1.5rem;
        border-radius: 8px;
        margin-bottom: 80px; /* Space for bottom navigation */
    }
    
    .order-form h2 {
        font-size: 1.3rem;
    }
    
    .form-section h3 {
        font-size: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .input-with-button {
        flex-direction: column;
    }
    
    .input-with-button .btn {
        width: 100%;
    }
    
    /* Order Summary Mobile */
    .order-summary {
        margin-bottom: 1rem;
    }
    
    .order-summary h3 {
        font-size: 1rem;
    }
    
    .summary-row {
        font-size: 0.9rem;
    }
    
    .summary-row.total {
        font-size: 1.1rem;
    }
    
    /* Payment Info Mobile */
    .payment-info {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .payment-info h3 {
        font-size: 1rem;
    }
    
    .bank-info p {
        font-size: 0.85rem;
    }
    
    /* Agreement Mobile */
    .agreement label {
        font-size: 0.9rem;
    }
    
    /* Captcha Mobile */
    .captcha {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #captcha-question {
        width: 100%;
        text-align: center;
    }
    
    #captcha-answer {
        width: 100%;
    }
    
    /* Submit Button Mobile */
    .btn-submit {
        font-size: 1rem;
        padding: 0.8rem;
    }
    
    /* Empty Cart Mobile */
    .empty-cart {
        padding: 3rem 1rem;
        margin-bottom: 80px;
    }
    
    .empty-cart svg {
        width: 80px;
        height: 80px;
    }
    
    .empty-cart h2 {
        font-size: 1.3rem;
    }
    
    .empty-cart p {
        font-size: 0.9rem;
    }
    
    /* Continue Shopping Link */
    .continue-shopping {
        display: block;
        text-align: center;
        margin-top: 1.5rem;
        padding: 0.5rem;
        background: var(--bg-light);
        border-radius: 4px;
    }
    
    /* Modal Mobile */
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
        width: calc(100% - 2rem);
    }
    
    .modal-content h2 {
        font-size: 1.3rem;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-actions .btn {
        width: 100%;
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Size Change Modal Mobile */
    .size-change-modal .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 0.5rem;
    }
    
    .size-change-modal .size-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .size-change-modal .size-option {
        padding: 1rem 0.5rem;
        font-size: 0.9rem;
        min-height: 60px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
}