/**
 * AWB Checker - Stiluri CSS
 * Stilizare pentru coloana AWB și modalul de upload
 */

/* Badge-uri pentru status AWB */
.badge-awb-present {
    background-color: #28a745 !important;
    color: white !important;
}

.badge-awb-missing {
    background-color: #dc3545 !important;
    color: white !important;
    cursor: pointer;
}

/* Butonul de upload AWB */
.btnawbupload {
    text-decoration: none !important;
}

.btnawbupload:hover .badge {
    opacity: 0.8;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* Modal de upload AWB */
.awb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 950;
    display: none;
}

.awb-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 999;
    min-width: 400px;
    max-width: 500px;
    display: none;
}

.awb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}

.awb-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 700;
}

.awb-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

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

.awb-modal-body {
    margin-bottom: 20px;
}

.awb-modal-body p {
    margin: 0 0 15px 0;
    color: #666;
}

.awb-modal-body .expedition-ref {
    font-weight: bold;
    color: #0066cc;
}

/* Referință expediție în titlul modalului - STIL POS */
.awb-modal-header .expedition-ref {
    font-weight: 800;
    color: #0066cc;
    font-size: 26px;
}

/* Zona de drag & drop */
.awb-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
}

.awb-dropzone:hover,
.awb-dropzone.dragover {
    border-color: #0066cc;
    background-color: #e8f4fd;
}

.awb-dropzone-icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 10px;
}

.awb-dropzone-text {
    color: #666;
    margin-bottom: 5px;
}

.awb-dropzone-hint {
    font-size: 12px;
    color: #999;
}

/* Input file ascuns */
.awb-file-input {
    display: none;
}

/* Progres upload */
.awb-upload-progress {
    display: none;
    margin-top: 15px;
}

.awb-progress-bar {
    height: 20px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.awb-progress-fill {
    height: 100%;
    background-color: #28a745;
    width: 0%;
    transition: width 0.3s ease;
}

.awb-progress-text {
    text-align: center;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Footer modal */
.awb-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.awb-btn {
    padding: 8px 20px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.awb-btn-cancel {
    background-color: #6c757d;
    color: white;
}

.awb-btn-cancel:hover {
    background-color: #5a6268;
}

.awb-btn-upload {
    background-color: #28a745;
    color: white;
}

.awb-btn-upload:hover {
    background-color: #218838;
}

.awb-btn-upload:disabled {
    background-color: #94d3a2;
    cursor: not-allowed;
}

/* Mesaje de succes/eroare */
.awb-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 15px;
    display: none;
}

.awb-message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.awb-message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Animație pentru refresh rând */
@keyframes awb-highlight {
    0% { background-color: #d4edda; }
    100% { background-color: transparent; }
}

.awb-row-updated {
    animation: awb-highlight 2s ease;
}

/* ============================================
 * STILURI PENTRU PRODUSE EXPANDABILE
 * ============================================
 */

/* Buton toggle produse (chevron) */
.awb-toggle-products {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    text-decoration: none !important;
    color: #6c757d;
    transition: all 0.2s ease;
    cursor: pointer;
    vertical-align: middle;
}

.awb-toggle-products:hover {
    color: #0066cc;
    transform: scale(1.1);
}

/* Iconița chevron */
.awb-chevron {
    transition: transform 0.3s ease;
    display: inline-block;
}

.awb-chevron-up {
    transform: rotate(180deg);
}

/* Stilizare pentru butonul toggle - hover */
.awb-toggle-products {
    cursor: pointer;
}

.awb-toggle-products:hover .awb-chevron {
    color: #0066cc;
}

/* Rânduri de produse */
.awb-product-row {
    background-color: #fffdf5 !important;
    border-left: 3px solid #ffc107;
}

.awb-product-row:hover {
    background-color: #fff9e6 !important;
}

/* Celulă indent pentru aliniere */
.awb-product-indent {
    width: 40px;
    min-width: 40px;
    background: linear-gradient(90deg, transparent 0%, #fffdf5 100%);
}

/* Celulă cu conținutul produsului */
.awb-product-cell {
    padding: 8px 15px !important;
}

/* Linia de produs - layout cu cantitate aliniată la dreapta */
.awb-product-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 20px;
    padding-right: 10px;
    font-size: 1.1em;
    gap: 15px;
}

/* Container pentru iconiță + ref + denumire (se extinde) */
.awb-product-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* Iconiță produs */
.awb-product-icon {
    color: #6c757d;
    font-size: 16px;
    opacity: 0.8;
    flex-shrink: 0;
}

/* Referință produs */
.awb-product-ref {
    font-weight: 700;
    color: #0066cc;
    text-decoration: none;
    font-size: 1.05em;
    flex-shrink: 0;
}

.awb-product-ref:hover {
    text-decoration: underline;
}

/* Denumire produs - afișare completă */
.awb-product-label {
    color: #333;
    font-weight: 500;
    white-space: normal;
    word-wrap: break-word;
    flex: 1;
}

/* Badge cantitate - ROȘU, aliniat la dreapta, lățime fixă */
.awb-product-qty {
    background-color: #dc3545 !important;
    color: white !important;
    font-weight: 700;
    padding: 4px 12px !important;
    font-size: 1em;
    white-space: nowrap;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
    flex-shrink: 0;
    min-width: 120px;
    text-align: center;
}

/* ============================================
 * STILURI PENTRU COLOANA FACTURĂ
 * ============================================
 */

/* Celulă factură */
.invoice-cell {
    white-space: nowrap;
}

.invoice-cell .badge {
    font-size: 0.85em;
}

.invoice-cell a {
    text-decoration: none;
}

.invoice-cell a:hover .badge {
    opacity: 0.85;
}

/* Iconiță descărcare/preview - spațiere consistentă */
.invoice-cell img.paddingleft,
.awb-cell img.paddingleft {
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.invoice-cell a:hover img,
.awb-cell a:hover img {
    opacity: 1;
}

/* ============================================
 * BUTOANE EXPAND ALL / COLLAPSE ALL
 * ============================================
 */

.awb-expand-controls {
    display: inline-flex;
    gap: 5px;
    margin-left: 10px;
}

.awb-expand-btn {
    padding: 2px 8px;
    font-size: 11px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    cursor: pointer;
    color: #495057;
    transition: all 0.2s ease;
}

.awb-expand-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* ============================================
 * ANIMAȚII
 * ============================================
 */

/* Animație pentru afișare rând produs */
@keyframes awb-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.awb-product-row {
    animation: awb-slide-down 0.2s ease;
}

/* ============================================
 * RESPONSIVE
 * ============================================
 */

@media (max-width: 600px) {
    .awb-modal {
        min-width: 90%;
        max-width: 95%;
        margin: 10px;
    }

    .awb-dropzone {
        padding: 20px;
    }

    .awb-product-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .awb-product-label {
        max-width: 100%;
    }
}

/* ============================================
 * PRINT STYLES
 * ============================================
 */

@media print {
    .awb-toggle-products {
        display: none !important;
    }

    .awb-product-row {
        display: table-row !important;
        border-left: none;
        background-color: #f8f9fa !important;
    }
}

/* ============================================
 * STILURI PENTRU BUTONUL ÎNCHIDE EXPEDIȚIE
 * ============================================
 */

.awb-close-expedition-btn {
    display: inline-block;
    background-color: #495057;
    color: white !important;
    text-decoration: none !important;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    transition: all 0.2s ease;
    vertical-align: middle;
    white-space: nowrap;
}

.awb-close-expedition-btn:hover {
    background-color: #343a40;
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    color: white !important;
    text-decoration: none !important;
}

.awb-close-expedition-btn:active {
    transform: scale(0.98);
}

/* Badge Aviz Închis - pentru avizele deja închise */
.awb-closed-badge {
    display: inline-block;
    background-color: #6c757d;
    color: white !important;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
    white-space: nowrap;
    opacity: 0.8;
}

/* Placeholder pentru a păstra alinierea când nu e buton */
.awb-status-placeholder {
    display: inline-block;
    width: 95px;
    margin-left: 8px;
}

/* Spinner pentru loading */
.fa-spinner.fa-spin {
    animation: awb-spin 1s linear infinite;
}

@keyframes awb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
 * STILURI PENTRU NOTIFICĂRI
 * ============================================
 */

@keyframes awb-slide-in {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes awb-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.awb-notification {
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.awb-notification-success {
    background-color: #d4edda !important;
    color: #155724 !important;
}

.awb-notification-error {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

/* ============================================
 * STILURI PENTRU MODALUL DE PRODUSE
 * ============================================
 */

/* Modal produse - LĂȚIME ȘI ÎNĂLȚIME MĂRITE PENTRU POS */
.awb-products-modal {
    min-width: 900px !important;
    max-width: 1200px !important;
    width: 95% !important;
}

/* Lista de produse - ÎNĂLȚIME MĂRITĂ PENTRU VIZIBILITATE POS */
.products-list {
    max-height: 600px;
    overflow-y: auto;
    padding: 15px 0;
}

/* Element produs individual - STIL POS MARKET */
.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    margin-bottom: 15px;
    background-color: #fff;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    border-left: 5px solid #28a745;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.product-item:hover {
    background-color: #f0f8ff;
    border-left-color: #fd7e14;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Container info produs (thumbnail + ref + denumire) */
.product-item .product-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
}

/* Thumbnail produs - MĂRIT PENTRU VIZIBILITATE POS */
.product-item .product-thumbnail {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid #dee2e6;
    flex-shrink: 0;
    background-color: white;
    transition: all 0.2s ease;
}

.product-item .product-thumbnail:hover {
    transform: scale(1.05);
    border-color: #ffc107;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 10;
}

/* Placeholder pentru produse fără imagine - MĂRIT */
.product-item .product-thumbnail-placeholder {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 3px dashed #dee2e6;
    flex-shrink: 0;
}

.product-item .product-thumbnail-placeholder .fa-image {
    color: #adb5bd;
    font-size: 48px;
}

/* Referință produs - TEXT FOARTE MARE POS */
.product-item .product-ref {
    font-weight: 800;
    color: #0066cc;
    text-decoration: none;
    font-size: 24px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    margin-right: 12px;
}

.product-item .product-ref:hover {
    text-decoration: underline;
}

/* Denumire produs - TEXT MARE POS */
.product-item .product-label {
    color: #333;
    font-weight: 600;
    font-size: 20px;
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
    flex: 1;
}

/* Cantitate produs - BADGE MARE POS */
.product-item .product-qty {
    background-color: #dc3545;
    color: white;
    font-weight: 800;
    padding: 15px 30px;
    font-size: 28px;
    white-space: nowrap;
    border-radius: 30px;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
    flex-shrink: 0;
    letter-spacing: 1px;
}

/* Mesaj "Nu există produse" */
.no-products {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 30px 20px;
    margin: 0;
}

/* Buton "Închide livrare" în modal */
.awb-btn-close-expedition {
    background-color: #495057 !important;
    color: white !important;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.awb-btn-close-expedition:hover {
    background-color: #343a40 !important;
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.awb-btn-close-expedition:disabled {
    background-color: #6c757d !important;
    cursor: not-allowed;
    transform: none;
}

/* Responsive pentru modal produse - STIL POS PĂSTRAT */
@media (max-width: 768px) {
    .awb-products-modal {
        min-width: 95% !important;
        max-width: 98% !important;
    }

    .product-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px 20px;
    }

    .product-item .product-info {
        flex-direction: row;
        align-items: center;
        gap: 15px;
        width: 100%;
    }

    .product-item .product-thumbnail,
    .product-item .product-thumbnail-placeholder {
        width: 100px;
        height: 100px;
    }

    .product-item .product-ref {
        font-size: 20px;
    }

    .product-item .product-label {
        font-size: 18px;
    }

    .product-item .product-qty {
        align-self: center;
        width: 100%;
        text-align: center;
        font-size: 24px;
        padding: 12px 24px;
    }
}

/* ============================================
 * STILURI PENTRU LIGHTBOX IMAGINI
 * ============================================
 */

/* Overlay lightbox */
.awb-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
}

/* Container lightbox */
.awb-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px 20px;
}

/* Buton închidere lightbox */
.awb-lightbox-close {
    position: fixed;
    top: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 40px;
    color: #333;
    cursor: pointer;
    z-index: 10002;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.awb-lightbox-close:hover {
    background: white;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
}

/* Container imagine lightbox */
.awb-lightbox-content {
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Imaginea în lightbox */
.awb-lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    animation: awb-lightbox-zoom-in 0.3s ease;
}

/* Caption imagine */
.awb-lightbox-caption {
    color: white;
    text-align: center;
    padding: 15px 20px;
    font-size: 16px;
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    max-width: 80%;
}

/* Animație zoom-in pentru imagine */
@keyframes awb-lightbox-zoom-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Cursor pointer pentru thumbnail-uri clickabile */
.clickable-thumbnail {
    cursor: pointer !important;
}

/* Responsive pentru lightbox */
@media (max-width: 768px) {
    .awb-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 30px;
    }

    .awb-lightbox-content {
        max-width: 95%;
    }

    .awb-lightbox-caption {
        font-size: 14px;
        max-width: 90%;
    }
}

/* ============================================
 * STILURI PENTRU BUTONUL PRINTEAZĂ AWB
 * ============================================
 */

/* Footer centrat pentru modal */
.awb-modal-footer-centered {
    justify-content: center !important;
    gap: 15px !important;
}

/* Buton "Printează AWB" - culoare albastru */
.awb-btn-print-awb {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    color: white !important;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.awb-btn-print-awb:hover {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

.awb-btn-print-awb:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.awb-btn-print-awb .fas {
    font-size: 16px;
}

/* Ajustare stiluri butoane pentru diferențiere clară */
.awb-btn-cancel {
    background-color: #6c757d !important;
    color: white !important;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.awb-btn-cancel:hover {
    background-color: #5a6268 !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(108, 117, 125, 0.4);
}

.awb-btn-close-expedition {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important;
    color: white !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.awb-btn-close-expedition:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}
