/* ===============================================
   SZCZEGÓŁY ZAMÓWIENIA - MODAL (Quick View)
   =============================================== */

/* Modal Overlay */
.modal-overlay-szczegoly {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Container */
.modal-szczegoly-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Close Button */
.modal-szczegoly-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.25rem;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-szczegoly-close:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Modal Content - Scrollable */
.szczegoly-container-modal {
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* Important for Firefox */
}

/* Custom Scrollbar */
.szczegoly-container-modal::-webkit-scrollbar {
    width: 8px;
}

.szczegoly-container-modal::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.szczegoly-container-modal::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.szczegoly-container-modal::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Modal Header - Compact */
.szczegoly-container-modal .szczegoly-header {
    margin-bottom: 0;
    border-radius: 20px 20px 0 0;
}

.szczegoly-container-modal .szczegoly-header-content {
    padding: 1.5rem;
}

.szczegoly-container-modal .order-number {
    font-size: 1.75rem;
}

.szczegoly-container-modal .order-title {
    font-size: 1rem;
}

/* Modal Content Area */
.szczegoly-container-modal .szczegoly-content-modal {
    padding: 1.5rem;
}

/* Tabs - Compact for modal */
.szczegoly-container-modal .details-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.szczegoly-container-modal .tab-btn {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid transparent;
}

.szczegoly-container-modal .tab-btn:hover {
    color: #00A651;
    background: rgba(0, 166, 81, 0.05);
}

.szczegoly-container-modal .tab-btn.active {
    color: #00A651;
    background: rgba(0, 166, 81, 0.1);
    border-bottom-color: #00A651;
}

/* Tab Content */
.szczegoly-container-modal .tab-content {
    display: none;
    animation: fadeIn 0.25s ease-out;
}

.szczegoly-container-modal .tab-content.active {
    display: block;
}

/* Info Grid in Modal */
.szczegoly-container-modal .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.szczegoly-container-modal .info-item {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid #00A651;
    /* FIX: Wyrównanie tekstu do lewej - FORCE */
    text-align: left !important;
    align-items: flex-start !important;
}

.szczegoly-container-modal .info-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* FIX: Wyrównanie do lewej - FORCE */
    justify-content: flex-start !important;
    text-align: left !important;
}

.szczegoly-container-modal .info-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    /* FIX: Tekst do lewej - FORCE */
    text-align: left !important;
    display: block;
    width: 100%;
}

/* Button - Full Details */
.btn-full-details {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #00A651 0%, #008541 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3);
}

.btn-full-details:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 166, 81, 0.4);
}

.btn-full-details i {
    font-size: 1.1rem;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-overlay-szczegoly {
        padding: 0;
    }
    
    .modal-szczegoly-container {
        max-height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    .modal-szczegoly-close {
        top: 1rem;
        right: 1rem;
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .szczegoly-container-modal .szczegoly-header-content {
        padding: 1.25rem;
    }
    
    .szczegoly-container-modal .order-number {
        font-size: 1.5rem;
    }
    
    .szczegoly-container-modal .order-meta {
        font-size: 0.85rem;
    }
    
    .szczegoly-container-modal .szczegoly-content-modal {
        padding: 1.25rem;
    }
    
    .szczegoly-container-modal .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .szczegoly-container-modal .details-tabs {
        gap: 0.25rem;
    }
    
    .szczegoly-container-modal .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ?? FIX CLS - Zapobiega ucięciu kafelków */
.szczegoly-container-modal .header-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    min-height: 120px; /* Rezerwacja miejsca dla kafelków */
}

.szczegoly-container-modal .visibility-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    border-radius: 50px;
    color: #1976D2;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.25);
    white-space: nowrap;
    /* ?? FIX - Zapobiega ucięciu */
    min-height: 44px;
    height: auto;
}

.szczegoly-container-modal .btn-header {
    min-height: 44px; /* Stała wysokość przycisku */
    height: auto;
    white-space: nowrap;
}

/* ?? FIX - Zapewnia że order-meta nie nakłada się na przyciski */
.szczegoly-container-modal .order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.95rem;
    margin-top: 0.75rem;
    margin-bottom: 1rem; /* Odstęp od przycisków */
}

.szczegoly-container-modal .order-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Animacja smooth dla całego modalu */
.modal-szczegoly-container * {
    transition-property: opacity, transform, background-color, border-color;
    transition-duration: 0.2s;
    transition-timing-function: ease-out;
}

/* Zapobiega miganiu podczas ładowania */
.szczegoly-container-modal .detail-card {
    min-height: 200px;
}

.szczegoly-container-modal .info-grid {
    min-height: 150px;
}
