/* hastone_warrantycart - Warranty CSS */

/* ========================================
   Modal
   ======================================== */

.warranty-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.warranty-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.warranty-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 540px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: warrantyModalIn 0.3s ease-out;
}

@keyframes warrantyModalIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.warranty-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.warranty-modal-close:hover {
    color: #333;
}

.warranty-modal-title {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    color: #333;
}

/* ========================================
   Step: Question
   ======================================== */

.warranty-question-text {
    font-size: 1.05em;
    color: #555;
    margin-bottom: 25px;
}

.warranty-question-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.warranty-question-actions .btn {
    min-width: 120px;
    padding: 10px 25px;
    font-size: 1em;
}

/* ========================================
   Step: Qty Question (multiple units)
   ======================================== */

.warranty-qty-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 25px;
}

.warranty-qty-input-wrapper .form-control {
    width: 80px;
    text-align: center;
    font-size: 1.2em;
    padding: 8px;
}

.warranty-qty-hint {
    color: #777;
    font-size: 0.9em;
}

/* ========================================
   Form Counter (unit X of Y)
   ======================================== */

.warranty-form-counter {
    background: #e8f4fd;
    color: #2a6496;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

/* ========================================
   Step: Form
   ======================================== */

#warranty-claim-form .form-group {
    margin-bottom: 18px;
}

#warranty-claim-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 0.95em;
    text-align: left;
}

#warranty-claim-form label .required {
    color: #e74c3c;
}

#warranty-claim-form .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#warranty-claim-form .form-control:focus {
    border-color: #2fb5d2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(47, 181, 210, 0.15);
}

#warranty-claim-form .form-control.is-invalid {
    border-color: #e74c3c;
}

.warranty-field-error {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 3px;
    min-height: 0;
}

#warranty-form-errors {
    margin-top: 15px;
}

#warranty-form-errors ul {
    margin: 0;
    padding-left: 18px;
}

.warranty-form-actions {
    display: flex;
    margin-top: 25px;
    justify-content: space-between;
    flex-direction: row-reverse;
}

.warranty-btn-submit {
    position: relative;
}

.warranty-btn-loading .rotating {
    animation: warrantyRotate 1s linear infinite;
    font-size: 18px;
    vertical-align: middle;
}

@keyframes warrantyRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   Step: Success
   ======================================== */

#warranty-step-success {
    text-align: center;
    padding: 20px 0;
}

.warranty-success-icon {
    width: 60px;
    height: 60px;
    background: #27ae60;
    color: #fff;
    font-size: 30px;
    line-height: 60px;
    border-radius: 50%;
    margin: 0 auto 15px;
}

/* ========================================
   Aesthetic Notice
   ======================================== */

.warranty-aesthetic-notice {
    margin: 10px 0;
}

.warranty-aesthetic-notice-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 0.95em;
}

.warranty-aesthetic-notice-content .material-icons {
    font-size: 20px;
    flex-shrink: 0;
}

/* ========================================
   Cart Summary
   ======================================== */

.warranty-cart-summary {
    margin: 20px 0;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 20px;
    background: #f9f9f9;
}

.warranty-summary-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1em;
    margin: 0 0 15px 0;
    color: #333;
}

.warranty-summary-title .material-icons {
    color: #2fb5d2;
    font-size: 22px;
}

.warranty-claims-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.warranty-claim-item {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    padding: 12px 15px;
}

.warranty-claim-product {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.warranty-claim-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.warranty-status-pending {
    background: #fff3cd;
    color: #856404;
}

.warranty-status-approved {
    background: #d4edda;
    color: #155724;
}

.warranty-status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.warranty-claim-details {
    color: #777;
    margin-bottom: 8px;
}

.warranty-claim-actions {
    text-align: right;
}

.warranty-cancel-claim {
    font-size: 0.85em;
}

.warranty-cancel-claim .material-icons {
    font-size: 16px;
    vertical-align: middle;
    margin-right: 3px;
}

/* ========================================
   Step: Select Existing Warranty
   ======================================== */

.warranty-existing-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 260px;
    overflow-y: auto;
}

.warranty-existing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #f9f9f9;
    transition: border-color 0.2s, background-color 0.2s;
}

.warranty-existing-item:hover {
    border-color: #2fb5d2;
    background: #f0fafc;
}

.warranty-existing-item-info {
    flex: 1;
    min-width: 0;
}

.warranty-existing-item-info strong {
    display: block;
    color: #333;
    font-size: 0.95em;
    margin-bottom: 2px;
}

.warranty-existing-item-info small {
    color: #777;
    font-size: 0.85em;
}

.warranty-existing-item .btn {
    flex-shrink: 0;
    margin-left: 12px;
}

.warranty-select-actions {
    margin-top: 10px;
    justify-content: center;
}

/* ========================================
   Cart Summary: Grouped Claims
   ======================================== */

.warranty-claim-group-single .warranty-claim-product {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.warranty-claim-serial {
    color: #777;
    font-weight: normal;
}

/* ========================================
   Cart Product Line: Warranty Badge
   ======================================== */

.warranty-cart-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    padding: 3px 8px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
}

.warranty-cart-badge .material-icons {
    font-size: 16px;
}

/* ========================================
   Cart Product Line: Inline Claims (per-unit)
   ======================================== */

.warranty-inline-claims {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Promoted (via warranty.js) to be the last child of .product-line-grid, whose
   columns are floated + cleared by .clearfix. clear:both drops the block below
   the columns and width:100% stretches it to the full product-line width. */
.product-line-grid > .warranty-inline-claims.warranty-inline-fullwidth {
    clear: both;
    width: 100%;
    flex-basis: 100%;
}

.warranty-inline-claim {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 10px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
}

.warranty-inline-claim-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.warranty-inline-claim-info .material-icons {
    font-size: 16px;
    color: #2e7d32;
    flex-shrink: 0;
}

.warranty-inline-claim-details {
    font-size: 0.82em;
    color: #333;
}

.warranty-inline-tag {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.92em;
    line-height: 1.5;
    white-space: nowrap;
}

.warranty-inline-tag-serial {
    background: #d9eafc;
    color: #1565c0;
    border: 1px solid #b3d4f5;
}

.warranty-inline-tag-incident {
    background: #fde8d2;
    color: #b45309;
    border: 1px solid #f7d3a8;
}

/* Unified inline action buttons (cancel / edit / delete) — identical shape and
   icon size across both blocks; the colour conveys the intent (red =
   destructive, grey = edit). */
.warranty-inline-claim .warranty-cancel-claim,
.warranty-inline-incident-actions .warranty-incident-edit-btn,
.warranty-inline-incident-actions .warranty-incident-delete-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 4px;
    line-height: 1;
    box-shadow: none;
}

.warranty-inline-claim .warranty-cancel-claim .material-icons,
.warranty-inline-incident-actions .warranty-incident-edit-btn .material-icons,
.warranty-inline-incident-actions .warranty-incident-delete-btn .material-icons {
    font-size: 16px;
    vertical-align: middle;
}

/* Destructive actions (cancel warranty / clear incident): red */
.warranty-inline-claim .warranty-cancel-claim,
.warranty-inline-incident-actions .warranty-incident-delete-btn {
    color: #c0392b;
}

.warranty-inline-claim .warranty-cancel-claim:hover,
.warranty-inline-incident-actions .warranty-incident-delete-btn:hover {
    background: rgba(192, 57, 43, 0.1);
    color: #a93226;
}

/* Edit action: neutral grey */
.warranty-inline-incident-actions .warranty-incident-edit-btn {
    color: #607d8b;
}

.warranty-inline-incident-actions .warranty-incident-edit-btn:hover {
    background: rgba(96, 125, 139, 0.12);
    color: #455a64;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 576px) {
    .warranty-modal-content {
        padding: 20px;
        margin: 10px;
    }

    .warranty-question-actions {
        flex-direction: column;
    }

    .warranty-question-actions .btn {
        width: 100%;
    }

    .warranty-form-actions {
        flex-direction: column-reverse;
    }

    .warranty-form-actions .btn {
        width: 100%;
    }

    .warranty-existing-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .warranty-existing-item .btn {
        margin-left: 0;
        width: 100%;
    }

    .warranty-claim-group-single .warranty-claim-product {
        flex-direction: column;
        gap: 2px;
    }

    .warranty-inline-claim {
        flex-wrap: wrap;
    }

    .warranty-inline-claim-details {
        white-space: normal;
    }
}

/* ========================================
   Inline non-warranty incident (cart page)
   ======================================== */

/* Same box model as .warranty-inline-claim — only the colour palette differs
   (neutral grey = hors garantie vs green = sous garantie). */
.warranty-inline-incident {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 10px;
    background: #eef1f4;
    border: 1px solid #d6dce1;
    border-radius: 4px;
}

.warranty-inline-incident-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    min-width: 0;
    flex: 1;
    font-size: 0.82em;
}

.warranty-inline-incident-info .material-icons {
    font-size: 16px;
    color: #607d8b;
    flex-shrink: 0;
}

.warranty-inline-incident-details {
    color: #333;
}

.warranty-inline-incident-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.warranty-inline-incident-controls {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.warranty-inline-incident-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.warranty-inline-incident-form .warranty-incident-input {
    width: 180px;
    height: 28px;
    font-size: 0.9em;
}

.warranty-incident-add-btn {
    padding: 0 4px;
    line-height: 1;
}

@media (max-width: 600px) {
    .warranty-inline-incident {
        flex-wrap: wrap;
    }

    .warranty-inline-incident-actions {
        margin-left: auto;
    }

    .warranty-inline-incident-form .warranty-incident-input {
        width: 100%;
        flex: 1;
    }
}

/* Bulk apply: "use this warranty for all N units" checkbox */
.warranty-bulk-apply-wrapper {
    margin: 10px 0;
    padding: 10px 12px;
    background: #f5f7ff;
    border: 1px solid #d5ddff;
    border-radius: 4px;
}

.warranty-bulk-apply-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-weight: 600;
}

.warranty-bulk-apply-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}
