/**
 * Cart Page Styles
 * Dedicated styles for standalone cart page with responsive design
 */

/* ===== CART PAGE CONTAINER ===== */
.cart-page-container {
    min-height: calc(100vh - 120px);
    background: #f8f9fa;
    padding-bottom: 80px; /* Space for bottom nav on mobile */
}

.cart-page-container .container-fluid {
    max-width: 1200px;
}

/* ===== COMPACT LAYOUT ===== */
.cart-page-container.compact {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.cart-page-container.compact .cart-items-section {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

/* ===== ORDER SUMMARY COMPACT ===== */
.order-summary-compact .card {
    border-radius: 15px;
    overflow: hidden;
}

.order-summary-compact .price-display h4 {
    font-size: 1.5rem;
    font-weight: 700;
}

/* ===== COMPACT CHECKOUT FORM ===== */
.compact-checkout-form .card {
    border-radius: 15px;
    overflow: hidden;
}

.compact-checkout-form .card-header {
    border-radius: 15px 15px 0 0 !important;
}

.form-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-section .form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

/* ===== MAP CONTAINER COMPACT ===== */
.map-container-compact {
    height: 250px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e9ecef;
    background: #f8f9fa;
}

/* ===== PAYMENT METHOD COMPACT ===== */
.payment-method-compact .form-check-input:checked + .form-check-label {
    background-color: #e7f3ff;
    border-color: #0066cc;
    color: #0066cc;
}

/* ===== MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .cart-page-container.compact {
        padding: 1rem 0;
    }

    .order-summary-compact .price-display {
        text-align: center !important;
        margin-top: 1rem;
    }

    .order-summary-compact .price-display h4 {
        font-size: 1.25rem;
    }

    .compact-checkout-form .card-header {
        text-align: center;
    }

    .compact-checkout-form .card-header .col-auto {
        display: none;
    }

    .form-section {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .map-container-compact {
        height: 200px;
    }

    .compact-checkout-form .btn-group {
        flex-wrap: wrap;
    }

    .compact-checkout-form .btn-group .btn {
        flex: 1 1 50%;
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 576px) {
    .cart-page-container.compact {
        padding: 0.5rem 0;
    }

    .cart-items-section {
        padding: 1rem !important;
        border-radius: 10px !important;
    }

    .form-section {
        padding: 0.5rem !important;
        border-radius: 8px !important;
    }

    .compact-checkout-form .form-control-sm {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }

    .section-title {
        font-size: 0.8rem;
        margin-bottom: 0.5rem !important;
    }

    .map-container-compact {
        height: 180px;
    }
}

/* ===== CART TITLE SECTION ===== */
.cart-title {
    color: #2E8B57;
    font-weight: 600;
    font-size: 1.5rem;
}

.cart-items-section {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1rem;
}

/* ===== CART ITEMS ===== */
.cart-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 1rem;
    background: white;
    transition: box-shadow 0.3s ease;
}

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

.cart-item:last-child {
    margin-bottom: 0;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 1rem;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.item-name {
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.item-price {
    color: #2E8B57;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #f8f9fa;
    border-color: #2E8B57;
    color: #2E8B57;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: #2d3436;
}

.cart-item-total {
    text-align: right;
    flex-shrink: 0;
}

.item-subtotal {
    font-weight: 700;
    color: #2E8B57;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* ===== ORDER SUMMARY SIDEBAR ===== */
.order-summary-sticky {
    position: sticky;
    top: 20px;
}

.order-summary-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.summary-header {
    background: linear-gradient(135deg, #2E8B57 0%, #228B22 100%);
    color: white;
    padding: 1.25rem;
    border-radius: 15px 15px 0 0;
}

.summary-header h5 {
    margin: 0;
    font-weight: 600;
}

.summary-body {
    padding: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: #6c757d;
}

.summary-row span:last-child {
    font-weight: 600;
    color: #2d3436;
}

.summary-divider {
    height: 2px;
    background: linear-gradient(to right, #e9ecef, #dee2e6, #e9ecef);
    margin: 1rem 0;
    border-radius: 1px;
}

.summary-total {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.total-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3436;
}

.total-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2E8B57;
}

.checkout-actions .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.checkout-actions .btn-primary {
    background: linear-gradient(135deg, #2E8B57, #228B22);
    border: none;
    box-shadow: 0 4px 15px rgba(46, 139, 87, 0.3);
}

.checkout-actions .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 139, 87, 0.4);
}

.checkout-actions .btn-primary:disabled {
    background: #6c757d;
    box-shadow: none;
    cursor: not-allowed;
}

/* ===== SHIPPING INFO CARD ===== */
.shipping-info-card {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border: 1px solid #d4edda;
    border-radius: 12px;
    padding: 1rem;
}

.info-header {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #2E8B57;
    margin-bottom: 0.5rem;
}

.info-content {
    color: #6c757d;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* ===== EMPTY CART STATE ===== */
.empty-cart {
    background: white;
    border-radius: 15px;
    padding: 3rem 2rem;
}

.empty-cart i {
    opacity: 0.5;
}

.empty-cart h5 {
    color: #6c757d;
}

.empty-cart .btn {
    border-radius: 25px;
    padding: 0.75rem 2rem;
    font-weight: 600;
}

/* ===== LOADING STATE ===== */
.cart-loading {
    background: white;
    border-radius: 15px;
    margin-bottom: 1rem;
}

.cart-loading i {
    color: #2E8B57;
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 991px) {
    .order-summary-sticky {
        position: relative;
        margin-top: 2rem;
    }

    .cart-page-container {
        padding-bottom: 100px;
    }
}

@media (max-width: 768px) {
    .cart-page-container .container-fluid {
        padding: 0 1rem;
    }

    .cart-items-section {
        padding: 1rem;
        border-radius: 12px;
    }

    .cart-title {
        font-size: 1.25rem;
    }

    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    .cart-item-image {
        width: 100%;
        height: 150px;
        margin-right: 0;
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    .cart-item-details {
        width: 100%;
        margin-bottom: 1rem;
    }

    .cart-item-total {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .summary-body {
        padding: 1rem;
    }

    .checkout-actions .btn {
        padding: 1rem;
        font-size: 1rem;
    }

    /* Mobile quantity controls */
    .quantity-controls {
        justify-content: center;
        margin-top: 0.5rem;
    }

    .qty-btn {
        width: 40px;
        height: 40px;
    }

    .qty-value {
        min-width: 50px;
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .cart-item-image {
        height: 120px;
    }

    .item-name {
        font-size: 0.95rem;
    }

    .item-price {
        font-size: 0.85rem;
    }

    .item-subtotal {
        font-size: 1rem;
    }

    .total-value {
        font-size: 1.2rem;
    }

    .summary-header {
        padding: 1rem;
    }

    .summary-header h5 {
        font-size: 1rem;
    }
}

/* ===== SMOOTH ANIMATIONS ===== */
.cart-item {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .cart-item {
        border: 2px solid #333;
    }

    .order-summary-card {
        border: 2px solid #333;
    }

    .summary-header {
        background: #2E8B57;
    }

    .btn-primary {
        background: #2E8B57 !important;
        border: 2px solid #000 !important;
    }
}

/* ===== FOCUS STATES FOR ACCESSIBILITY ===== */
.qty-btn:focus,
.btn:focus {
    outline: 2px solid #2E8B57;
    outline-offset: 2px;
}

/* ===== WHATSAPP VALIDATION STYLES ===== */
#customerPhone.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

/* ===== ORDER SUMMARY DETAILS STYLES ===== */
.order-summary-details {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

.order-summary-details .row {
    margin-bottom: 0.5rem;
}

.order-summary-details .text-muted.small {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.order-summary-details .fw-semibold {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

#shippingDistanceCompact {
    color: #0d6efd !important;
    font-weight: 600;
}

#shippingCostCompact {
    color: #198754 !important;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .order-summary-details {
        padding: 0.75rem;
    }

    .order-summary-details .text-muted.small {
        font-size: 0.7rem;
    }

    .order-summary-details .fw-semibold {
        font-size: 0.85rem;
    }
}

/* ===== LOCATION BUTTON STYLES ===== */
#currentLocationBtn {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    transition: all 0.3s ease;
    min-width: 40px;
}

#currentLocationBtn:hover {
    background-color: #0066cc;
    border-color: #0066cc;
    color: white;
}

#currentLocationBtn:active {
    transform: scale(0.95);
}

#currentLocationBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#currentLocationBtn.loading {
    pointer-events: none;
}

/* Address search input group styling */
.input-group #addressSearchCompact {
    border-right: none;
}

.input-group #addressSearchCompact:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.input-group #addressSearchCompact:focus + #currentLocationBtn {
    border-color: #86b7fe;
}

/* ===== ENHANCED CART ITEM DESIGN ===== */
.cart-item {
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cart-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    border-color: #2E8B57;
}

.cart-item-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.cart-item-image {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f9fa;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    line-height: 1.3;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-notes,
.btn-remove {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    color: #6c757d;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.btn-notes:hover {
    background: #fff3cd;
    color: #856404;
}

.btn-remove:hover {
    background: #f8d7da;
    color: #721c24;
}

.item-price {
    font-size: 1rem;
    font-weight: 600;
    color: #2E8B57;
    margin-bottom: 1rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.qty-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #495057;
}

.qty-btn:hover {
    background: #2E8B57;
    border-color: #2E8B57;
    color: white;
    transform: scale(1.05);
}

.qty-value {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: #2c3e50;
    min-width: 60px;
    text-align: center;
}

.cart-item-total {
    text-align: right;
    padding-top: 1rem;
}

.item-subtotal {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2E8B57;
}

/* ===== NOTES FUNCTIONALITY ===== */
.item-notes {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 200px;
        transform: translateY(0);
    }
}

.notes-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.notes-textarea {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.notes-textarea:focus {
    border-color: #2E8B57;
    box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.1);
    outline: none;
}

.save-notes-btn {
    background: #2E8B57;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    height: fit-content;
}

.save-notes-btn:hover {
    background: #228B22;
    transform: scale(1.05);
}

.current-notes {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.current-notes small {
    font-style: italic;
    line-height: 1.4;
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 768px) {
    .cart-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .cart-item-content {
        flex-direction: column;
        text-align: center;
    }

    .cart-item-image {
        width: 80px;
        height: 80px;
        margin: 0 auto 1rem;
    }

    .item-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.5rem;
    }

    .item-actions {
        justify-content: center;
    }

    .quantity-controls {
        justify-content: center;
    }

    .cart-item-total {
        text-align: center;
        padding-top: 0.5rem;
    }

    .notes-input-group {
        flex-direction: column;
    }

.save-notes-btn {
        align-self: flex-end;
    }
}

/* ===== INLINE CHECKOUT FLOW ===== */
.checkout-flow-container {
    background: linear-gradient(180deg, #f8fbf8 0%, #ffffff 100%);
    border-top: 1px solid #e9ecef;
}

.checkout-flow-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.checkout-step {
    margin-bottom: 2rem;
}

.inline-checkout-card {
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 18px 45px rgba(46, 139, 87, 0.12);
    overflow: hidden;
    border: none;
}

.inline-checkout-card .modern-header {
    border-radius: 22px 22px 0 0;
}

.inline-checkout-card .modern-body,
.inline-checkout-card .modal-body {
    padding: 2rem;
}

.inline-checkout-card .modern-footer,
.inline-checkout-card .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.checkout-flow-container .step-indicator {
    font-weight: 600;
    letter-spacing: 0.05em;
}

.qris-card .badge {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.qris-card .qris-image {
    border-radius: 16px;
    border: 1px solid rgba(34, 139, 34, 0.15);
    padding: 12px;
    background: #ffffff;
}

.checkout-flow-container .d-grid .btn {
    border-radius: 12px;
}

@media (max-width: 768px) {
    .inline-checkout-card .modern-body,
    .inline-checkout-card .modal-body {
        padding: 1.5rem;
    }

    .inline-checkout-card .modern-footer,
    .inline-checkout-card .modal-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .checkout-flow-container .step-indicator {
        display: none;
    }
}

/* ===== ANTI-CONFLICT PREFIXES ===== */
.cart-page-container .cart-item,
.cart-page-container .cart-item-image,
.cart-page-container .cart-item-details,
.cart-page-container .item-header,
.cart-page-container .item-actions,
.cart-page-container .quantity-controls {
    /* Ensure cart page styles take precedence */
}

/* ===== PRINT STYLES ===== */
@media print {
    .cart-page-container {
        background: white;
    }

    .checkout-actions,
    .qty-btn,
    .btn-remove,
    .btn-notes,
    .save-notes-btn {
        display: none;
    }

    .order-summary-card {
        box-shadow: none;
        border: 1px solid #000;
    }

    .item-notes {
        border-top: 1px solid #000;
    }
}
