:root {
    --zim-green: #2d6a4f;
    --zim-dark: #23272b;
    --zim-light: #f8f9fa;
}

html {
    font-size: 17px;
}

body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background-color: var(--zim-light);
}

/* dcc.Input in this Dash version wraps the real <input> in a container div
   that receives the className (e.g. "form-control") instead of the input
   itself. Without this, the real input stays at native browser size,
   leaving most of the visible styled box unclickable/untypeable. */
.dash-input-container.form-control {
    display: flex;
    align-items: center;
}

.dash-input-container .dash-input-element {
    width: 100%;
    height: 100%;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0;
    font: inherit;
    color: inherit;
}

/* Navbar */
.navbar {
    background-color: white !important;
    border-bottom: 2px solid var(--zim-green);
}

.navbar-brand {
    color: var(--zim-green) !important;
    font-weight: 600;
    letter-spacing: 0.8px;
}

/* Footer */
footer {
    background-color: white;
    color: var(--zim-green);
    border-top: 1px solid #dee2e6;
}

/* Card headers */
.card-header {
    background-color: var(--zim-green) !important;
    color: white !important;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* DataTable font */
.dash-table-container .dash-spreadsheet-container,
.dash-table-container .dash-spreadsheet-container .dash-header,
.dash-table-container .dash-spreadsheet-container .dash-cell,
.dash-table-container .dash-spreadsheet-container .dash-cell div {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif !important;
    font-size: 0.85rem;
}

/* Chat widget */
.chat-toggle-btn {
    position: fixed;
    bottom: 64px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--zim-green);
    color: white;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    z-index: 1100;
    cursor: pointer;
}

.chat-toggle-btn:hover {
    background-color: #234f3b;
}

.chat-panel {
    position: fixed;
    bottom: 132px;
    right: 24px;
    width: 360px;
    height: 480px;
    min-width: 300px;
    min-height: 320px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 160px);
    z-index: 1100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: none;
}

.chat-panel-header {
    position: relative;
    background-color: var(--zim-green) !important;
    color: white !important;
    font-weight: 500;
    flex-shrink: 0;
    padding-left: 24px;
}

.chat-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 1101;
}

.chat-resize-handle::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    width: 8px;
    height: 8px;
    border-top: 2px solid rgba(255, 255, 255, 0.7);
    border-left: 2px solid rgba(255, 255, 255, 0.7);
}

.chat-persona-dropdown {
    min-width: 150px;
    font-size: 0.8rem;
    color: #212529 !important;
}

.chat-persona-dropdown .Select-value-label,
.chat-persona-dropdown .Select-control,
.chat-persona-dropdown input,
.chat-persona-dropdown .VirtualizedSelectOption,
.chat-persona-dropdown [class*="-singleValue"],
.chat-persona-dropdown [class*="-control"] {
    color: #212529 !important;
}

.chat-panel-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px;
}

.chat-messages {
    flex: 1 1 auto;
    min-height: 80px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    padding-right: 4px;
}

.chat-gate {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.chat-gate-label {
    font-size: 0.85rem;
    color: var(--zim-dark);
}

.chat-gate-error {
    font-size: 0.8rem;
    color: #c0392b;
    min-height: 1em;
}

.chat-body-unlocked {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.chat-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.chat-bubble-user {
    align-self: flex-end;
    background-color: var(--zim-green);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-bubble-assistant p {
    margin: 0 0 6px 0;
}

.chat-bubble-assistant p:last-child {
    margin-bottom: 0;
}

.chat-bubble-assistant ul, .chat-bubble-assistant ol {
    margin: 0 0 6px 0;
    padding-left: 20px;
}

.chat-bubble-assistant {
    align-self: flex-start;
    background-color: var(--zim-light);
    border: 1px solid #dee2e6;
    color: var(--zim-dark);
    border-bottom-left-radius: 2px;
}

.chat-bubble-system {
    align-self: center;
    background-color: transparent;
    color: #6c757d;
    font-style: italic;
    font-size: 0.78rem;
}

.chat-proposal-card {
    align-self: stretch;
    border: 1px solid var(--zim-green);
    border-left: 4px solid var(--zim-green);
    border-radius: 6px;
    padding: 10px 12px;
    background-color: #eaf3ee;
    font-size: 0.83rem;
}

.chat-proposal-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.chat-send-btn {
    background-color: var(--zim-green) !important;
    color: white !important;
    border: none !important;
}

.chat-send-btn:hover {
    background-color: #234f3b !important;
}

.chat-controls-row {
    font-size: 0.78rem;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.chat-loading-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chat-input-row {
    flex-shrink: 0;
    margin-top: auto;
}

.chat-allow-writes-checkbox {
    cursor: pointer;
    color: var(--zim-dark);
}

.chat-save-transcript-btn {
    background-color: transparent !important;
    color: var(--zim-green) !important;
    border: 1px solid var(--zim-green) !important;
    font-size: 0.75rem;
    padding: 2px 8px;
}

.chat-save-transcript-btn:hover {
    background-color: var(--zim-green) !important;
    color: white !important;
}

.chat-disclaimer {
    font-size: 0.72rem;
    color: #6c757d;
    margin-bottom: 8px;
    line-height: 1.3;
    flex-shrink: 0;
}

.chat-tool-trace {
    background-color: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 0.72rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    margin: 4px 0 0 0;
}

.chat-tool-trace-details summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: #6c757d;
}
