/**
 * VTS Báo Giá - Modal Styles
 * Styles for quote modal and quote items
 */

/* Modal Container - Semantic HTML */
.modal-quote,
aside.modal-quote {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.modal-quote-content,
article.modal-quote-content {
    position: relative;
    background-color: white;
    margin: 3% auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    border-radius: 5px;
    overflow-y: scroll;
    max-height: 90vh;
}

.modal-quote-header,
header.modal-quote-header {
    padding: 20px;
    border-bottom: 1px solid #e2dfdf;
    position: relative;
}

.modal-quote-body,
section.modal-quote-body {
    padding: 20px;
}

.modal-quote-footer,
footer.modal-quote-footer {
    padding: 20px;
    border-top: 1px solid #e2dfdf;
    background-color: #f9f9f9;
}

.modal-quote-content p {
    display: none;
}

h2.modal-quote-title{
        margin-bottom: 0;
}

.modal-quote-close {
    position: absolute;
    top: -11px;
    right: 0px;
    font-size: 28px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    line-height: 1;
    color: #666;
    margin: 0;
}

.modal-quote-close:hover {
    color: #000;
}

/* Quote Items */
.quote-items-container {
    margin-top: 0px;
}

.quote-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2dfdf;
}

.quote-item-img {
    width: 60px;
    height: 60px;
    max-width: 200px;
    object-fit: cover;
    margin-right: 15px;
}

.quote-item-info {
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: center;
    align-items: center;
}

.quote-item-remove {
    color: #e53935;
    cursor: pointer;
    margin-left: 10px;
}

/* Quote Item Quantity Controls */
.quote-item-quantity input[type="number"] {
    border: 1px solid #dedbdb;
    border-radius: 4px;
    padding: 0
}

.quote-item-quantity label {
    font-size: 11px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: center;
    align-items: center;
    gap: 1px;
}

.quantity-control {
    display: flex;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: flex-start;
    justify-content: center;
}

.btn-quantity-decrease,
.btn-quantity-increase {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    margin: 0;
    display: none;
}

.quantity-input {
    width: 60px;
    text-align: center;
    margin: 0 5px;
    border: 1px solid #ddd;
    padding: 5px;
}

/* Quote Actions - Semantic HTML */
.quote-actions,
nav.quote-actions {
    margin-top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quote-actions button {
    transition: all 0.5s;
    background-color: #FFCC00;
    border-color: #FFCC00;
    border-radius: 6px;
    text-transform: unset;
    padding: 0px 20px;
    cursor: pointer;
    margin-bottom: 0;
}

.js-clear-quote,
.js-clear-quote:hover {
    float: right;
    background: transparent !important;
    color: red !important;
    font-weight: 700 !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
    border: none !important;
    box-shadow: none;
}

/* Quote Form */
.quote-form-container {
    padding: 20px 0;
}

#quote-form label {
    font-weight: 500;
    margin-bottom: 5px;
    display: block;
}

#quote-form .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#quote-form textarea.form-control {
    resize: vertical;
}

/* Quote Items Table */
#quote-items-table tr {
    padding: 0.5rem 0.75rem;
    vertical-align: top;
    border: 1px solid #424242 !important;
    word-break: break-all;
}

/* Keyboard Navigation Focus Styles */
.modal-quote button:focus,
.modal-quote input:focus,
.modal-quote select:focus,
.modal-quote textarea:focus,
.modal-quote a:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.modal-quote-close:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.quote-item-remove:focus {
    outline: 2px solid #e53935;
    outline-offset: 2px;
}

.btn-quantity-decrease:focus,
.btn-quantity-increase:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
    background-color: #e8e8e8;
}

.quantity-input:focus {
    outline: 2px solid #2196f3;
    outline-offset: 1px;
    border-color: #2196f3;
}

/* Ensure focus is visible for keyboard users */
.modal-quote *:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Responsive Styles */

/* Mobile - Extra Small (< 576px) */
@media (max-width: 575px) {
    .modal-quote-content {
        width: 95%;
        max-width: 100%;
        margin: 2% auto;
        max-height: 96vh;
    }

    .modal-quote-header,
    .modal-quote-body,
    .modal-quote-footer {
        padding: 15px;
    }

    .modal-quote-close {
        top: 10px;
        right: 15px;
        font-size: 24px;
    }

    .quote-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 0;
    }

    .quote-item-img {
        width: 100%;
        height: auto;
        max-height: 150px;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .quote-item-info {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .quote-item-quantity {
        width: 100%;
    }

    .quote-item-quantity input[type="number"] {
        width: 100%;
        max-width: 100px;
    }

    .quote-actions {
        flex-direction: column;
        gap: 10px;
    }

    .quote-actions button {
        width: 100%;
        margin: 0 !important;
    }

    .js-clear-quote {
        order: 2;
        text-align: center;
    }

    #quote-items-table {
        font-size: 12px;
    }

    #quote-items-table tr {
        padding: 0.3rem 0.5rem;
    }
}

/* Tablet - Small to Medium (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .modal-quote-content {
        width: 90%;
        margin: 3% auto;
    }

    .modal-quote-header,
    .modal-quote-body,
    .modal-quote-footer {
        padding: 18px;
    }

    .quote-item-img {
        width: 80px;
        height: 80px;
    }

    .quote-actions {
        flex-wrap: wrap;
        gap: 10px;
    }

    .quote-actions button {
        flex: 1 1 auto;
        min-width: 150px;
    }
}

/* Tablet - Medium (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .modal-quote-content {
        width: 85%;
        max-width: 700px;
    }

    .quote-item-img {
        width: 70px;
        height: 70px;
    }
}

/* Desktop - Large (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .modal-quote-content {
        width: 80%;
        max-width: 750px;
    }
}

/* Desktop - Extra Large (> 1200px) */
@media (min-width: 1200px) {
    .modal-quote-content {
        width: 75%;
        max-width: 800px;
    }

    .quote-item:hover {
        background-color: #f9f9f9;
    }

    .quote-item-remove:hover {
        color: #c62828;
        transform: scale(1.1);
        transition: all 0.2s ease;
    }
}
