/* ============================================
   Responsive Fixes & UI Improvements
   ============================================ */

/* ===========================================
   GLOBAL RESPONSIVE - Ensure content fits screen
   =========================================== */
html {
    overflow-x: hidden;
}

body {
    min-width: 320px;
    overflow-x: hidden;
}

.main-content {
    max-width: 100%;
    overflow-x: hidden;
}

.page-container {
    max-width: 100%;
    overflow-x: hidden;
}

/* ===========================================
   TOP HEADER - Globalny nagłówek CRM
   Uwaga: główne style w header.css
   =========================================== */

/* Stary styl - wyłączony na rzecz nowego globalnego nagłówka */
/*
.top-header {
    height: var(--header-height, 70px);
    background: var(--bg-card, #ffffff);
    border-bottom: 1px solid var(--border-color, #e8ecef);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
*/

/* Stare ukrywanie elementów - wyłączone */
/*
.top-header .header-content,
.top-header .header-left,
.top-header .search-box,
.top-header .search-bar,
.top-header .header-btn:not(.logout-btn-new),
.top-header .badge,
.top-header .menu-toggle {
    display: none !important;
}
*/

/* Nowe style dla header-right - integracja z globalnym nagłówkiem */
/*
.top-header .header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
}
*/

/* Stare ukrywanie przycisków - wyłączone */
/*
.top-header .header-right > *:not(.logout-btn-new):not(#logoutBtn) {
    display: none !important;
}
*/

/* New logout button style - kompatybilne z header.css */
.logout-btn-new,
.top-header #logoutBtn {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #e74c3c !important;
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn-new:hover,
#logoutBtn:hover {
    background: #c0392b !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.logout-btn-new i,
#logoutBtn i {
    font-size: 1rem;
}

/* Legacy logout-btn class override */
.logout-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 20px !important;
    background: #e74c3c !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #c0392b !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* ===========================================
   SIDEBAR MENU - Submenu collapsed by default
   =========================================== */

/* Remove default open state */
.sidebar-nav .has-submenu .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Only open when has .open class */
.sidebar-nav .has-submenu.open .submenu {
    max-height: 500px;
}

/* Parent menu item highlighting when expanded */
.sidebar-nav .has-submenu.open > a {
    background: rgba(255,255,255,0.1);
    color: var(--text-white, #ffffff);
}

/* Submenu items - no highlight by default */
.sidebar-nav .submenu a {
    background: transparent;
    color: rgba(255,255,255,0.6);
    transition: all 0.2s ease;
}

/* Submenu items - highlight only on hover */
.sidebar-nav .submenu a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-white, #ffffff);
    padding-left: 58px;
}

/* Active submenu item */
.sidebar-nav .submenu li.active > a,
.sidebar-nav .submenu a.active {
    background: linear-gradient(135deg, var(--primary-green, #2d5a27) 0%, var(--primary-green-light, #4a9142) 100%);
    color: var(--text-white, #ffffff);
}

/* Arrow rotation for expanded menu */
.sidebar-nav .has-submenu .submenu-arrow {
    transition: transform 0.3s ease;
}

.sidebar-nav .has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

/* ===========================================
   MOBILE TABLES - Fix filters and layout
   =========================================== */

/* Table wrapper improvements */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Ensure table uses available width efficiently */
.data-table {
    width: 100%;
    table-layout: auto;
    font-size: 0.85rem;
}

/* Default column sizing - flexible */
.data-table th,
.data-table td {
    padding: 10px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Checkbox column - fixed small */
.data-table .col-checkbox,
.data-table th:first-child,
.data-table td:first-child {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    text-align: center;
}

/* Actions column - fixed */
.data-table .col-actions,
.data-table th:last-child,
.data-table td:last-child {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 100px !important;
}

/* Filter autocomplete */
.filter-autocomplete {
    position: relative;
    width: 100%;
}

.filter-autocomplete input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    font-size: 11px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
}

/* Filter row improvements */
.data-table thead tr.filter-row th {
    padding: 6px 4px;
}

.data-table thead tr.filter-row input[type="text"] {
    min-width: 50px;
    width: 100%;
    font-size: 11px;
    padding: 4px 6px;
}

/* Mobile responsive breakpoints */
@media (max-width: 1200px) {
    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .data-table thead tr.filter-row input[type="text"] {
        font-size: 11px;
        padding: 4px;
    }
}

@media (max-width: 1024px) {
    /* Sidebar mobile toggle */
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* Menu toggle jest teraz wewnątrz nagłówka - kontrolowany przez header.css */
    /* Stare style dla fixed menu toggle - wyłączone */
    /*
    .menu-toggle {
        display: block !important;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 999;
        background: var(--primary-green, #2d5a27);
        color: white;
        border: none;
        border-radius: 8px;
        padding: 10px 14px;
        font-size: 1.2rem;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    
    .top-header {
        padding-left: 70px;
    }
    */
    
    .page-container {
        padding: 20px 15px;
    }
}

@media (max-width: 768px) {
    .page-container {
        padding: 15px 10px;
    }
    
    .content-card {
        border-radius: 8px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 15px;
    }
    
    .card-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Table mobile adjustments */
    .data-table {
        min-width: 500px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    .data-table thead tr.filter-row th {
        padding: 4px 2px;
    }
    
    .data-table thead tr.filter-row input[type="text"] {
        font-size: 10px;
        padding: 3px 4px;
    }
    
    /* Action buttons on mobile */
    .action-buttons,
    .actions-cell {
        flex-direction: row;
        gap: 4px;
    }
    
    .btn-icon {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }
    
    /* Page header */
    .page-header h1 {
        font-size: 1.2rem;
    }
    
    /* Top header mobile */
    .top-header {
        padding: 0 15px 0 70px;
        height: 60px;
    }
    
    #logoutBtn,
    .logout-btn,
    .logout-btn-new {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
    }
    
    #logoutBtn span,
    .logout-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .page-container {
        padding: 10px 8px;
    }
    
    .data-table {
        min-width: 400px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
        font-size: 0.75rem;
    }
    
    .btn-icon {
        width: 28px;
        height: 28px;
    }
    
    /* Hide some columns on very small screens */
    .hide-mobile {
        display: none !important;
    }
}

/* ===========================================
   PRODUCTS TABLE - Match other tables style
   =========================================== */

/* Products table should match agreements/contractors style */
.data-table tbody tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

.data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.data-table tbody tr:hover {
    background: #e8f4f8 !important;
}

/* Products action buttons - match other tables */
.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

.actions-cell .action-btn,
.action-buttons .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f0f3f7;
    color: #2c3e50;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.actions-cell .action-btn:hover,
.action-buttons .btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.actions-cell .action-btn[title="Edytuj"],
.actions-cell .action-btn:first-child:not(.text-danger) {
    color: #2d5a27;
}

.actions-cell .action-btn.text-danger,
.actions-cell .action-btn[title="Usuń"] {
    color: #e74c3c;
}

.actions-cell .action-btn.text-danger:hover,
.actions-cell .action-btn[title="Usuń"]:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* ===========================================
   SCROLLBAR for table wrapper
   =========================================== */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===========================================
   TABLE CENTER ALIGNMENT
   =========================================== */
.data-table th,
.data-table td {
    text-align: center !important;
    vertical-align: middle;
}

.data-table .th-sortable {
    justify-content: center;
}

/* Nazwa firmy/produktu może być wyrównana do lewej */
.data-table td:nth-child(2) strong {
    display: block;
    text-align: center;
}

/* ===========================================
   RODZAJ MULTI-SELECT CHECKBOX DROPDOWN
   =========================================== */
.rodzaj-multiselect-wrapper {
    position: relative;
    width: 100%;
}

.rodzaj-multiselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid #e8ecef;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.95rem;
    color: #2c3e50;
    min-height: 42px;
    transition: all 0.2s ease;
    user-select: none;
    gap: 8px;
}

.rodzaj-multiselect-trigger:hover {
    border-color: #cbd5e0;
}

.rodzaj-multiselect-trigger:focus {
    outline: none;
    border-color: #2d5a27;
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

.rodzaj-multiselect-trigger.readonly {
    background: #f7fafc;
    color: #5a6c7d;
    cursor: default;
    pointer-events: none;
}

.rodzaj-multiselect-trigger .rodzaj-chevron {
    font-size: 0.7rem;
    color: #95a5a6;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.rodzaj-multiselect-trigger.open .rodzaj-chevron {
    transform: rotate(180deg);
}

.rodzaj-multiselect-placeholder {
    color: #a0aec0;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rodzaj-multiselect-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.rodzaj-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #e8f5e9;
    color: #2d5a27;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.rodzaj-tag .rodzaj-tag-remove {
    cursor: pointer;
    font-size: 10px;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.rodzaj-tag .rodzaj-tag-remove:hover {
    opacity: 1;
}

.rodzaj-multiselect-trigger.readonly .rodzaj-tag .rodzaj-tag-remove {
    display: none;
}

.rodzaj-multiselect-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: white;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 4px 0;
}

.rodzaj-multiselect-dropdown.show {
    display: block;
}

.rodzaj-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #2c3e50;
    transition: background-color 0.15s ease;
    user-select: none;
}

.rodzaj-checkbox-item:hover {
    background-color: #f0fdf4;
}

.rodzaj-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #2d5a27;
    cursor: pointer;
    flex-shrink: 0;
}

.rodzaj-checkbox-item label {
    cursor: pointer;
    flex: 1;
    margin: 0 !important;
    font-weight: 400 !important;
    font-size: 14px !important;
}

/* Rodzaj badge w tabeli */
.rodzaj-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    margin: 1px 2px;
}

/* ===========================================
   COMMENT ANIMATION
   =========================================== */
@keyframes commentSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
    }
}

.comment-item.comment-new {
    animation: commentSlideIn 0.5s ease-out forwards;
    background-color: #e8f5e9 !important;
}

.comment-item {
    transition: background-color 0.3s ease;
}

/* ===========================================
   CONTRACTOR MODAL - SPLIT LAYOUT
   =========================================== */

/* Extra large modal for split view */
.modal-content.modal-xlarge {
    width: 96%;
    max-width: 1800px;
    max-height: 90vh;
}

/* Split layout container */
.modal-split-layout {
    display: flex;
    gap: 20px;
    min-height: 450px;
}

/* Left panel - form data */
.modal-left-panel {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
    padding-right: 12px;
}

/* Right panel - relations */
.modal-right-panel {
    width: 320px;
    min-width: 280px;
    max-width: 320px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px;
    overflow-y: scroll;
    max-height: calc(80vh - 120px);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overscroll-behavior: contain;
}

/* Contractor card: wider right panel with 2-column grid */
#contractorModal .modal-right-panel {
    width: 660px;
    min-width: 500px;
    max-width: 700px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-content: start;
    overflow-y: scroll;
    max-height: calc(80vh - 120px);
    overscroll-behavior: contain;
}

/* Files section spans full width in contractor */
#contractorModal .modal-right-panel > .relations-section:last-child {
    grid-column: 1 / -1;
}

/* Umowy zakupowe i sprzedażowe na pełną szerokość */
#contractorModal .contractor-full-width {
    grid-column: 1 / -1;
}

/* Sekcja plików - zwijana */
#contractorModal .contractor-files-section .relations-content {
    max-height: 500px;
    overflow-y: auto;
    transition: max-height .3s ease, opacity .2s ease, padding .2s ease;
    opacity: 1;
}

#contractorModal .contractor-files-section.collapsed .relations-content {
    max-height: 0;
    opacity: 0;
    padding: 0;
    overflow: hidden;
}

#contractorModal .contractor-files-section .collapse-chevron {
    transition: transform .2s ease;
}

#contractorModal .contractor-files-section.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

/* Sekcje umów w kontrahent - więcej wierszy */
#contractorModal .relations-content {
    max-height: none;
}

/* Sekcje w kontrahent - elastyczna wysokość z limitem */
#contractorModal .relations-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#contractorModal .relations-section .relations-content {
    flex: 1;
    max-height: 280px;
    overflow-y: auto;
}

/* ============================================
   RELATIONS SECTION - UNIFIED DESIGN
   Spójny design dla wszystkich modułów
   ============================================ */

.relations-section {
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.relations-section:last-child {
    margin-bottom: 0;
}

/* Nagłówek sekcji - jednolity pasek */
.relations-header {
    display: flex;
    align-items: stretch;
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    min-height: 44px;
}

.relations-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0 14px;
    flex: 1;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.relations-header h3 i {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Akcje nagłówka - licznik i przycisk */
.relations-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.1);
}

.relations-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.relations-add-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.7rem;
}

.relations-add-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
}

/* Zawartość listy */
.relations-content {
    max-height: 350px;
    overflow-y: auto;
    overflow-anchor: none;
    background: #fafbfc;
}

.relations-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: #64748b;
    font-size: 0.85rem;
}

.relations-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    color: #94a3b8;
    text-align: center;
}

.relations-empty i {
    font-size: 1.6rem;
    margin-bottom: 8px;
    opacity: 0.4;
}

.relations-empty span {
    font-size: 0.8rem;
}

/* Elementy listy */
.relation-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.relation-item:last-child {
    border-bottom: none;
}

.relation-item:hover {
    background: #f0f9ff;
    transform: translateX(4px);
}

/* Ikony elementów - pastelowe tła */
.relation-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.relation-item-icon.contact-icon {
    background: #dbeafe;
    color: #2563eb;
}

.relation-item-icon.warehouse-icon {
    background: #fef3c7;
    color: #d97706;
}

.relation-item-icon.agreement-icon {
    background: #dcfce7;
    color: #16a34a;
}

.relation-item-icon.package-icon {
    background: #f3e8ff;
    color: #9333ea;
}

.relation-item-icon.transport-icon {
    background: #ffedd5;
    color: #ea580c;
}

.relation-item-icon.sales-agreement-icon {
    background: #fce7f3;
    color: #db2777;
}

/* Treść elementu */
.relation-item-content {
    flex: 1;
    min-width: 0;
}

.relation-item-title {
    font-weight: 600;
    font-size: 0.82rem;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.relation-item-subtitle {
    font-size: 0.73rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    line-height: 1.2;
}

.relation-item-arrow {
    color: #94a3b8;
    margin-left: 8px;
    transition: all 0.15s ease;
    font-size: 0.7rem;
    flex-shrink: 0;
    align-self: center;
}

.relation-item:hover .relation-item-arrow {
    transform: translateX(3px);
    color: #3b82f6;
}

/* Rozszerzony element paczki z wieloma wierszami */
.relation-item-expanded {
    align-items: flex-start;
    padding: 12px 14px;
}

.relation-item-expanded .relation-item-icon {
    margin-top: 2px;
}

.relation-item-expanded .relation-item-arrow {
    margin-top: 50%;
    transform: translateY(-50%);
}

.relation-item-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 2px 0;
    font-size: 0.78rem;
    line-height: 1.4;
}

.relation-item-row:first-child {
    padding-top: 0;
}

.relation-label {
    color: #475569;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.75rem;
    min-width: 16px;
    text-align: center;
}

.relation-value {
    color: #1e293b;
    font-weight: 500;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relation-value-highlight {
    color: #059669;
    font-weight: 700;
}

/* Agreement status badges */
.relation-item-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-completed {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

/* Form section icons in left panel */
.modal-left-panel .form-section h3 i {
    color: #2d5a27;
    margin-right: 8px;
}

/* ============================================
   RESPONSIVE - MODAL SPLIT LAYOUT
   ============================================ */
@media (max-width: 1024px) {
    .modal-split-layout {
        flex-direction: column;
    }
    
    .modal-right-panel {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        max-height: 250px;
        order: -1;
        margin-bottom: 16px;
    }

    #contractorModal .modal-right-panel {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        grid-template-columns: 1fr 1fr;
        max-height: 350px;
    }
    
    .modal-left-panel {
        max-height: none;
        padding-right: 0;
    }
    
    .modal-content.modal-xlarge {
        max-height: 95vh;
    }
}

@media (max-width: 768px) {
    #contractorModal .modal-right-panel {
        grid-template-columns: 1fr;
    }

    .relations-content {
        max-height: 120px;
    }
    
    .modal-right-panel {
        padding: 10px;
        gap: 10px;
    }
    
    .relations-header h3 {
        font-size: 0.75rem;
        padding: 0 10px;
    }
    
    .relations-header h3 i {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
    }
    
    .relations-header-actions {
        padding: 0 10px;
        gap: 6px;
    }
    
    .relations-count {
        min-width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    .relations-add-btn {
        width: 22px;
        height: 22px;
    }
    
    .relation-item {
        padding: 8px 10px;
    }
    
    .relation-item-icon {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
        margin-right: 8px;
    }
    
    .relation-item-title {
        font-size: 0.78rem;
    }
    
    .relation-item-subtitle {
        font-size: 0.7rem;
    }
}

/* ============================================

    color: #64748b !important;
    cursor: not-allowed;
    border-color: #e2e8f0 !important;
}

input:disabled,
textarea:disabled,
select:disabled {
    background: #f8fafc !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
}

/* ============================================
   MODAL MEDIUM SIZE
   ============================================ */
.modal-content.modal-medium {
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}


/* ============================================
   TRANSPORTS TABLE - column wrapping & compact
   ============================================ */

/* Kierowca cell - first name above last name */
.kierowca-cell {
    white-space: normal !important;
    line-height: 1.3;
    min-width: 70px;
}
.kierowca-cell .kierowca-line {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tablice cell - ciagnik above naczepa */
.tablice-cell {
    white-space: normal !important;
    line-height: 1.3;
    min-width: 70px;
    font-size: 0.8rem;
}
.tablice-cell .tablice-line {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* FV cells - allow wrapping */
.fv-cell {
    white-space: normal !important;
    word-break: break-all;
    max-width: 80px;
    font-size: 0.78rem;
}

/* Firma transportowa - allow wrapping */
.firma-cell {
    white-space: normal !important;
    word-break: break-word;
    max-width: 130px;
    line-height: 1.3;
}
