/* --- 0. GLOBÁLNÍ ÚPRAVY PRO CHAT-FIRST --- */
#chat-workspace {
    /* Zajišťujeme plné vyplnění výšky bez přetékání a plynulé zmenšování na menších monitorech */
    height: 100%;
    min-height: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 1.5rem;
}

.conv-list-panel {
    /* Dynamická šířka: zkusí zabrat 20%, nenechá se zmenšit pod 250px, nepřekročí 320px */
    flex: 1 1 20%;
    min-width: 250px;
    max-width: 320px;
    height: 100%;
}

.chat-main-panel {
    /* Chatovací okno má prioritu v zabírání zbylého místa */
    flex: 2 1 50%;
    min-width: 300px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.task-draft-panel {
    /* Dynamická šířka pro panel úkolu */
    flex: 1 1 25%;
    min-width: 280px;
    max-width: 380px;
    height: 100%;
}

/* --- CHAT BUBBLES --- */
.message-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.4;
    position: relative;
    margin-bottom: 0.5rem;
}
.message-advisor {
    background-color: #2563eb; /* blue-600 */
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
}
.message-assistant {
    background-color: #27272a; /* zinc-800 */
    color: #f4f4f5;
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
}
.message-system {
    background-color: rgba(30, 58, 138, 0.2); /* blue-900/20 */
    color: #93c5fd; /* blue-300 */
    align-self: center;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* --- VOICE MESSAGE --- */
.voice-wave {
    display: flex;
    align-items: center;
    gap: 2px;
}
.wave-bar {
    width: 2px;
    height: 12px;
    background: currentColor;
    border-radius: 1px;
}

/* --- TASK PANEL & DRAFTS --- */
.draft-card {
    background: rgba(24, 24, 27, 0.6);
    border: 1px solid #3f3f46;
    border-radius: 1rem;
    padding: 1.25rem;
    backdrop-filter: blur(8px);
}
.field-missing {
    color: #f87171; /* red-400 */
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}
.field-filled {
    color: #4ade80; /* green-400 */
    background: rgba(74, 222, 128, 0.1);
    border-left: 3px solid #22c55e;
}

/* Pulse animation for AI parsing */
@keyframes ai-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}
.ai-thinking {
    animation: ai-pulse 1.5s infinite ease-in-out;
}

/* --- 1. DRAG & DROP ZÓNA --- */
#drop-zone {
    transition: all 0.2s ease-in-out;
    background-color: rgba(39, 39, 42, 0.2); /* zinc-800 s průhledností */
}

/* Třída přidávaná přes JS při eventu 'dragover' */
#drop-zone.bg-zinc-800 {
    background-color: rgba(39, 39, 42, 0.8) !important;
    border-color: #3b82f6 !important; /* blue-500 */
    transform: scale(1.01);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

/* Seznam souborů - scrollování */
#bo-file-list {
    scrollbar-width: thin;
    scrollbar-color: #52525b #27272a;
}
#bo-file-list::-webkit-scrollbar {
    width: 4px;
}
#bo-file-list::-webkit-scrollbar-track {
    background: transparent;
}
#bo-file-list::-webkit-scrollbar-thumb {
    background-color: #52525b;
    border-radius: 4px;
}

/* --- 2. VÝSLEDKY VYHLEDÁVÁNÍ (AUTOCOMPLETE) --- */
#bo-search-results {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    border-color: #3f3f46; /* zinc-700 */
    max-height: 250px;
    overflow-y: auto;
}
#bo-search-results > div:first-child {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}
#bo-search-results > div:last-child {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-bottom: 0;
}

/* --- 3. KANBAN KARTY (BACKOFFICE SPECIFIC) --- */
.border-l-4.border-red-500 {
    background: linear-gradient(90deg, rgba(239,68,68,0.1) 0%, rgba(39,39,42,0) 100%);
}

#kanban-bo-new > div:hover,
#kanban-bo-processing > div:hover,
#kanban-bo-done > div:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* --- 4. MODÁLNÍ OKNO (DETAIL) --- */
#bo-detail-content pre {
    white-space: pre-wrap;       
    white-space: -moz-pre-wrap;  
    white-space: -pre-wrap;      
    white-space: -o-pre-wrap;    
    word-wrap: break-word;       
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* --- 5. BUTTON STYLES (Overrides) --- */
.status-change-btn {
    border: 1px solid transparent;
    transition: all 0.2s;
}
.status-change-btn:hover {
    filter: brightness(1.2);
}

/* --- 6. RESPONZIVITA (Media Queries) --- */
/* Pro menší notebooky a tablety (do 1024px) přeskládáme panely pod sebe */
@media (max-width: 1024px) {
    #chat-workspace {
        flex-direction: column;
        height: auto;
        min-height: 100%;
        overflow-y: auto;
    }
    .conv-list-panel, .task-draft-panel {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 250px;
        flex: none; /* zruší flexibilitu z předchozího pravidla */
    }
    .chat-main-panel {
        width: 100%;
        max-width: 100%;
        height: 60vh;
        min-height: 450px;
        flex: none;
    }
}

/* Extra malé obrazovky (Mobily do 768px) */
@media (max-width: 768px) {
    #chat-workspace {
        gap: 1rem;
    }
    #bo-client-preview { grid-template-columns: 1fr; }
    #bo-dynamic-form-container .grid-cols-2,
    #bo-dynamic-form-container .grid-cols-3 { grid-template-columns: 1fr !important; gap: 0.75rem; }
    .kanban-column { min-height: auto; margin-bottom: 1.5rem; }
    .modal-lg { width: 100% !important; max-width: 100% !important; height: 100% !important; max-height: 100vh !important; margin: 0 !important; border-radius: 0 !important; }
    .modal-body-flex > .grid { grid-template-columns: 1fr !important; }
    .lg\:col-span-2.border-r { border-right: none !important; border-bottom: 1px solid #27272a; }
    #bo-chat-messages { min-height: 250px; max-height: 400px; }
    #notif-dropdown { width: calc(100vw - 2rem); right: -1rem; }
    .px-6.pt-4.border-b.flex.space-x-4 { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 1px; }
    .profile-tab-btn { white-space: nowrap; }
}

/* --- VYNUCENÍ TMAVÉHO REŽIMU PRO MODÁLNÍ OKNA --- */
.modal, 
.modal-header, 
.modal-body, 
.modal-body-flex, 
.modal-footer {
    background-color: #18181b !important; 
    color: #f4f4f5 !important;            
    border-color: #27272a !important;     
}