/*
 * QUOTE PICKER LIGHTBOX
 * Stile per il selettore di preventivi da FattureInCloud
 */

/* ============================================================================
   LIGHTBOX OVERLAY
   ============================================================================ */
.quote-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.quote-picker-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================================================
   LIGHTBOX CONTAINER
   ============================================================================ */
.quote-picker-lightbox {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background: var(--color-surface, #fff);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 3001;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.quote-picker-lightbox.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ============================================================================
   LIGHTBOX HEADER
   ============================================================================ */
.quote-picker-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-bg, #f9fafb);
    border-radius: 12px 12px 0 0;
}

.quote-picker-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text, #1f2937);
    margin: 0;
}

.quote-picker-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-secondary, #6b7280);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.quote-picker-close:hover {
    background: var(--color-border, #e5e7eb);
    color: var(--color-text, #1f2937);
}

/* ============================================================================
   LIGHTBOX BODY
   ============================================================================ */
.quote-picker-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Loading State */
.quote-picker-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.quote-picker-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border, #e5e7eb);
    border-top-color: var(--color-primary, #f2a71b);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.quote-picker-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--color-text-secondary, #6b7280);
}

.quote-picker-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Error State */
.quote-picker-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--color-danger, #ef4444);
}

/* ============================================================================
   QUOTES TABLE
   ============================================================================ */
.quote-picker-table {
    width: 100%;
    border-collapse: collapse;
}

.quote-picker-table thead {
    position: sticky;
    top: 0;
    background: var(--color-bg, #f9fafb);
    z-index: 1;
}

.quote-picker-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary, #6b7280);
    border-bottom: 2px solid var(--color-border, #e5e7eb);
}

.quote-picker-table th:last-child {
    text-align: right;
}

.quote-picker-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    font-size: 0.95rem;
    color: var(--color-text, #1f2937);
}

.quote-picker-table td:last-child {
    text-align: right;
    font-weight: 600;
}

.quote-picker-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.quote-picker-table tbody tr:hover {
    background: var(--color-primary-light, rgba(242, 167, 27, 0.08));
}

.quote-picker-table tbody tr:active {
    background: var(--color-primary-light, rgba(242, 167, 27, 0.15));
}

/* Quote ID badge */
.quote-id-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--color-primary-light, rgba(242, 167, 27, 0.1));
    color: var(--color-primary-dark, #d4940f);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Quote subject (oggetto) */
.quote-subject {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-secondary, #6b7280);
    font-size: 0.9rem;
}

/* Quote amount */
.quote-amount {
    color: var(--color-success, #22c55e);
    font-weight: 700;
}

/* ============================================================================
   LIGHTBOX FOOTER (PAGINATION)
   ============================================================================ */
.quote-picker-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-bg, #f9fafb);
    border-radius: 0 0 12px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quote-picker-info {
    font-size: 0.9rem;
    color: var(--color-text-secondary, #6b7280);
}

.quote-picker-pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quote-picker-pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-surface, #fff);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text, #1f2937);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quote-picker-pagination button:hover:not(:disabled) {
    background: var(--color-primary-light, rgba(242, 167, 27, 0.1));
    border-color: var(--color-primary, #f2a71b);
}

.quote-picker-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quote-picker-page-info {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary, #6b7280);
}

/* ============================================================================
   SEARCH BUTTON STYLING
   ============================================================================ */
.input-with-button {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

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

.btn-search-quote {
    padding: 0 0.875rem;
    background: var(--color-primary, #f2a71b);
    color: white;
    border: none;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.btn-search-quote:hover {
    background: var(--color-primary-dark, #d4940f);
    transform: translateY(-1px);
}

.btn-search-quote:active {
    transform: translateY(0);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 640px) {
    .quote-picker-lightbox {
        width: 95%;
        max-height: 90vh;
    }

    .quote-picker-header {
        padding: 1rem;
    }

    .quote-picker-title {
        font-size: 1rem;
    }

    .quote-picker-table th,
    .quote-picker-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .quote-subject {
        max-width: 120px;
    }

    .quote-picker-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
}
