/* Order Summary Popup Styles */

#order-summary-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    backdrop-filter: blur(4px);
}

#order-summary-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    direction: rtl;
}

.order-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.order-summary-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    color: #1f1f1f;
}

#close-order-summary {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#close-order-summary:hover {
    background: #f5f5f5;
}

.order-summary-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

#order-summary-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

#order-summary-empty {
    text-align: center;
    padding: 40px;
}

#order-summary-empty p {
    font-size: 18px;
    color: #666;
}

#order-summary-table {
    width: 100%;
    border-collapse: collapse;
}

#order-summary-table thead th {
    text-align: right;
    padding: 12px 8px;
    border-bottom: 2px solid #eee;
    font-weight: 700;
    font-size: 14px;
    color: #666;
}

#order-summary-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

#order-summary-table tbody td {
    padding: 12px 8px;
    vertical-align: middle;
}

#order-summary-table .product-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
}

#order-summary-table .product-name {
    font-weight: 600;
    font-size: 15px;
}

#order-summary-table .product-price,
#order-summary-table .product-subtotal {
    font-weight: 700;
}

/* Quantity controls in popup */
#order-summary-table .qty-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 4px 6px;
    background: #fff;
}

#order-summary-table .qty-control button {
    width: 28px;
    height: 28px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#order-summary-table .qty-control button:hover {
    background: #f5f5f5;
}

#order-summary-table .qty-control input {
    width: 50px;
    height: 28px;
    border: none;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    background: transparent;
}

#order-summary-table .qty-control input:focus {
    outline: none;
}

#order-summary-table .remove-item {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: #999;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#order-summary-table .remove-item:hover {
    background: #fee;
    border-color: #fcc;
    color: #c00;
}

#order-summary-table tfoot td {
    padding: 16px 8px;
    border-top: 2px solid #eee;
}

#order-summary-total {
    font-size: 20px;
    color: #1f1f1f;
}

.order-summary-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #eee;
    background: #fafafa;
    border-radius: 0 0 20px 20px;
}

.order-summary-footer .btn-secondary,
.order-summary-footer .btn-primary {
    flex: 1;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
}

.order-summary-footer .btn-secondary {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
}

.order-summary-footer .btn-secondary:hover {
    background: #f5f5f5;
}

.order-summary-footer .btn-primary {
    background: #1f1f1f;
    border: 1px solid #1f1f1f;
    color: #fff;
}

.order-summary-footer .btn-primary:hover {
    background: #333;
}

.order-summary-footer .btn-primary.disabled {
    background: #ccc;
    border-color: #ccc;
    color: #888;
    cursor: not-allowed;
    pointer-events: none;
}

/* Shipping section */
#order-summary-shipping {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

#order-summary-shipping .shipping-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 12px;
    color: #1f1f1f;
}

#order-summary-shipping .shipping-methods {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#order-summary-shipping .shipping-method {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

#order-summary-shipping .shipping-method:hover {
    border-color: #1f1f1f;
}

#order-summary-shipping .shipping-method.selected {
    border-color: #1f1f1f;
    background: #fafafa;
}

#order-summary-shipping .shipping-method input[type="radio"] {
    margin: 0;
}

#order-summary-shipping .shipping-method-label {
    flex: 1;
    font-weight: 600;
}

#order-summary-shipping .shipping-method-cost {
    font-weight: 700;
    color: #1f1f1f;
}

/* Totals section */
#order-summary-totals {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

#order-summary-totals .totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 15px;
}

#order-summary-totals .totals-row:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

#order-summary-totals .totals-final {
    padding-top: 12px;
    margin-top: 4px;
    font-size: 18px;
}

#order-summary-totals .totals-final strong {
    color: #1f1f1f;
}

/* Terms checkbox */
#order-summary-terms {
    margin-top: 16px;
    padding: 16px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 12px;
}

#order-summary-terms .terms-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
}

#order-summary-terms .terms-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#order-summary-terms .terms-checkbox a {
    color: #1976d2;
    text-decoration: underline;
}

#order-summary-terms .terms-checkbox a:hover {
    color: #1565c0;
}

#order-summary-terms.error {
    border-color: #f44336;
    background: #ffebee;
}

#order-summary-terms.error .terms-checkbox {
    color: #c62828;
}

/* Responsive */
@media (max-width: 600px) {
    #order-summary-popup {
        width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }
    
    .order-summary-header {
        padding: 16px;
    }
    
    .order-summary-header h2 {
        font-size: 18px;
    }
    
    .order-summary-content {
        padding: 12px;
    }
    
    /* הסתרת הטבלה הרגילה במובייל */
    #order-summary-table {
        display: block;
    }
    
    #order-summary-table thead {
        display: none;
    }
    
    #order-summary-table tbody {
        display: block;
    }
    
    #order-summary-table tbody tr {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 14px;
        margin-bottom: 10px;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 12px;
    }
    
    #order-summary-table tbody td {
        padding: 0;
        border: none;
    }
    
    /* תמונה */
    #order-summary-table tbody td:nth-child(1) {
        flex: 0 0 60px;
    }
    
    #order-summary-table tbody td:nth-child(1) img {
        width: 60px;
        height: 60px;
        border-radius: 8px;
    }
    
    /* תוכן מרכזי - שם + מחיר + סה"כ */
    #order-summary-table tbody td:nth-child(2) {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    #order-summary-table tbody td.product-name {
        font-size: 14px;
        font-weight: 700;
    }
    
    /* מחיר ליחידה */
    #order-summary-table tbody td:nth-child(3) {
        display: none;
    }
    
    /* כמות */
    #order-summary-table tbody td:nth-child(4) {
        flex: 0 0 auto;
    }
    
    #order-summary-table tbody td:nth-child(4) .qty-control {
        gap: 4px;
    }
    
    #order-summary-table tbody td:nth-child(4) .qty-control button {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    #order-summary-table tbody td:nth-child(4) .qty-control input {
        width: 40px;
        height: 32px;
        font-size: 14px;
    }
    
    /* סה"כ לשורה */
    #order-summary-table tbody td:nth-child(5) {
        flex: 0 0 auto;
        font-weight: 700;
        font-size: 15px;
        color: #1f1f1f;
    }
    
    /* סיכום מחירים */
    #order-summary-totals {
        padding: 12px;
        margin-top: 16px;
    }
    
    #order-summary-totals .totals-row {
        font-size: 14px;
        padding: 6px 0;
    }
    
    #order-summary-totals .totals-final {
        font-size: 16px;
    }
    
    /* תקנון */
    #order-summary-terms {
        padding: 12px;
        margin-top: 12px;
    }
    
    #order-summary-terms .terms-checkbox {
        font-size: 13px;
    }
    
    /* כפתורים */
    .order-summary-footer {
        flex-direction: column;
        padding: 16px;
        gap: 10px;
    }
    
    .order-summary-footer button {
        width: 100%;
        height: 48px;
        font-size: 16px;
    }
    
    /* משלוח */
    #order-summary-shipping {
        padding: 12px;
        margin-top: 12px;
    }
    
    #order-summary-shipping .shipping-title {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    #order-summary-shipping .shipping-method {
        padding: 10px;
        font-size: 14px;
    }
}

/* הודעת הצלחה */
.order-success {
    text-align: center;
    padding: 60px 20px;
}

.order-success .success-icon {
    width: 80px;
    height: 80px;
    background: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 40px;
    color: white;
}

.order-success h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1f1f1f;
    margin: 0 0 16px;
}

.order-success p {
    font-size: 16px;
    color: #666;
    margin: 0 0 8px;
}

.order-success p strong {
    color: #1f1f1f;
}
