/**
 * Mercedes Workshop System - High Contrast Theme
 * Improves visibility of form fields, buttons, and section dividers
 */

/* ============================================
   FORM FIELDS - Darker borders, better definition
   ============================================ */

/* Input fields, selects, textareas */
.fi-input,
.fi-select-input,
.fi-textarea,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="search"],
select,
textarea {
    border-color: #9ca3af !important;
    border-width: 1.5px !important;
}

.fi-input:focus,
.fi-select-input:focus,
.fi-textarea:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: #374151 !important;
    box-shadow: 0 0 0 2px rgba(55, 65, 81, 0.2) !important;
}

/* Dark mode input fields */
.dark .fi-input,
.dark .fi-select-input,
.dark .fi-textarea,
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="number"],
.dark input[type="date"],
.dark input[type="time"],
.dark input[type="password"],
.dark input[type="search"],
.dark select,
.dark textarea {
    border-color: #6b7280 !important;
}

.dark .fi-input:focus,
.dark .fi-select-input:focus,
.dark .fi-textarea:focus,
.dark input:focus,
.dark select:focus,
.dark textarea:focus {
    border-color: #9ca3af !important;
    box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.3) !important;
}

/* ============================================
   BUTTONS - More distinct, better contrast
   ============================================ */

/* Primary buttons - darker, more prominent */
.fi-btn-primary,
button[type="submit"].fi-btn,
.fi-btn.fi-color-primary {
    background-color: #374151 !important;
    border: 2px solid #1f2937 !important;
    color: white !important;
    font-weight: 600 !important;
}

.fi-btn-primary:hover,
button[type="submit"].fi-btn:hover,
.fi-btn.fi-color-primary:hover {
    background-color: #1f2937 !important;
    border-color: #111827 !important;
}

/* Secondary/outline buttons */
.fi-btn-secondary,
.fi-btn.fi-color-gray {
    border: 2px solid #6b7280 !important;
    color: #374151 !important;
    font-weight: 500 !important;
}

.fi-btn-secondary:hover,
.fi-btn.fi-color-gray:hover {
    background-color: #f3f4f6 !important;
    border-color: #374151 !important;
}

/* Dark mode buttons */
.dark .fi-btn-primary,
.dark button[type="submit"].fi-btn,
.dark .fi-btn.fi-color-primary {
    background-color: #4b5563 !important;
    border-color: #6b7280 !important;
}

.dark .fi-btn-primary:hover,
.dark button[type="submit"].fi-btn:hover,
.dark .fi-btn.fi-color-primary:hover {
    background-color: #6b7280 !important;
}

.dark .fi-btn-secondary,
.dark .fi-btn.fi-color-gray {
    border-color: #9ca3af !important;
    color: #e5e7eb !important;
}

/* ============================================
   SECTIONS & CARDS - Better separation
   ============================================ */

/* Section cards */
.fi-section,
.fi-card {
    border: 1.5px solid #d1d5db !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.dark .fi-section,
.dark .fi-card {
    border-color: #4b5563 !important;
}

/* Remove inner borders from component containers inside sections */
.fi-section .fi-fo-component-ctn {
    border: none !important;
    box-shadow: none !important;
}

.dark .fi-section .fi-fo-component-ctn {
    border: none !important;
}

/* Section headers - consistent styling */
.fi-section-header {
    border-bottom: none !important;
}

.dark .fi-section-header {
    border-bottom-color: transparent !important;
}

/* Section content area - uses Filament's native border-t */
.fi-section-content-ctn {
    border-top: 1px solid #e5e7eb !important;
}

.dark .fi-section-content-ctn {
    border-top-color: #374151 !important;
}

/* Section header titles */
.fi-section-header-heading {
    font-weight: 700 !important;
    color: #1f2937 !important;
}

.dark .fi-section-header-heading {
    color: #f3f4f6 !important;
}

/* ============================================
   TABLES - Better row definition
   ============================================ */

/* Table headers */
.fi-ta-header-cell {
    background-color: #f3f4f6 !important;
    border-bottom: 2px solid #d1d5db !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
}

.dark .fi-ta-header-cell {
    background-color: #374151 !important;
    border-bottom-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

/* Table rows - Alternating backgrounds for readability */
.fi-ta-row {
    border-bottom: none !important;
}

/* Odd rows - light gray background */
.fi-ta-row:nth-child(odd) {
    background-color: #f9fafb !important;
}

/* Even rows - white background */
.fi-ta-row:nth-child(even) {
    background-color: #ffffff !important;
}

.fi-ta-row:hover {
    background-color: #e5e7eb !important;
}

/* Dark mode alternating rows */
.dark .fi-ta-row:nth-child(odd) {
    background-color: #1f2937 !important;
}

.dark .fi-ta-row:nth-child(even) {
    background-color: #111827 !important;
}

.dark .fi-ta-row:hover {
    background-color: #374151 !important;
}

/* Remove cell borders for cleaner look */
.fi-ta-cell {
    border: none !important;
}

/* Table borders - only when not inside a section */
.fi-ta-ctn {
    border: 1.5px solid #d1d5db !important;
}

.dark .fi-ta-ctn {
    border-color: #4b5563 !important;
}

/* Remove table container border when inside a section (prevent double border) */
.fi-section .fi-ta-ctn {
    border: none !important;
    box-shadow: none !important;
}

.dark .fi-section .fi-ta-ctn {
    border: none !important;
}

/* ============================================
   INFOLIST ENTRIES - Better visual separation
   ============================================ */

/* Remove entry borders for cleaner look inside sections */
.fi-in-entry {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.dark .fi-in-entry {
    border-bottom-color: transparent;
}

/* ============================================
   INFOLIST WRAPPER - Clean outer styling
   ============================================ */

/* Remove any borders from the outer infolist dl wrapper */
.fi-page dl,
.fi-resource-view-record-page dl {
    border: none !important;
    box-shadow: none !important;
    margin: 0;
    padding: 0;
}

/* Ensure outer component container doesn't add visual elements */
.fi-page > section > div > dl > .fi-fo-component-ctn,
.fi-resource-view-record-page dl > .fi-fo-component-ctn {
    border: none !important;
    box-shadow: none !important;
}

/* Entry labels */
.fi-in-entry-wrp > dt,
.fi-in-entry-label {
    font-weight: 600 !important;
    color: #4b5563 !important;
}

.dark .fi-in-entry-wrp > dt,
.dark .fi-in-entry-label {
    color: #9ca3af !important;
}

/* ============================================
   NAVIGATION - Better active state
   ============================================ */

.fi-sidebar-item-button.fi-active {
    background-color: #e5e7eb !important;
    border-left: 3px solid #374151 !important;
    font-weight: 600 !important;
}

.dark .fi-sidebar-item-button.fi-active {
    background-color: #374151 !important;
    border-left-color: #9ca3af !important;
}

/* ============================================
   TABS - Better distinction
   ============================================ */

.fi-tabs-tab {
    border-bottom: 2px solid transparent !important;
}

.fi-tabs-tab[aria-selected="true"],
.fi-tabs-tab.fi-active {
    border-bottom-color: #374151 !important;
    font-weight: 600 !important;
}

.dark .fi-tabs-tab[aria-selected="true"],
.dark .fi-tabs-tab.fi-active {
    border-bottom-color: #9ca3af !important;
}

/* ============================================
   BADGES - More visible
   ============================================ */

.fi-badge {
    font-weight: 600 !important;
    border: 1px solid currentColor !important;
}

/* ============================================
   FIELDSETS & GROUPS - Visual grouping
   ============================================ */

.fi-fo-fieldset {
    border: 1.5px solid #d1d5db !important;
    border-radius: 0.5rem;
    padding: 1rem !important;
}

.dark .fi-fo-fieldset {
    border-color: #4b5563 !important;
}

/* ============================================
   FORM LABELS - More prominent
   ============================================ */

.fi-fo-field-wrp > label,
.fi-fo-field-label {
    font-weight: 600 !important;
    color: #374151 !important;
    margin-bottom: 0.375rem !important;
}

.dark .fi-fo-field-wrp > label,
.dark .fi-fo-field-label {
    color: #d1d5db !important;
}

/* ============================================
   MODAL DIALOGS - Better separation
   ============================================ */

.fi-modal-window {
    border: 2px solid #d1d5db !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

.dark .fi-modal-window {
    border-color: #4b5563 !important;
}

/* ============================================
   ACTION ICONS - Better visibility
   ============================================ */

.fi-ac-icon-btn {
    border: 1px solid #d1d5db !important;
}

.fi-ac-icon-btn:hover {
    background-color: #f3f4f6 !important;
    border-color: #9ca3af !important;
}

.dark .fi-ac-icon-btn {
    border-color: #4b5563 !important;
}

.dark .fi-ac-icon-btn:hover {
    background-color: #374151 !important;
}

/* ============================================
   LAYOUT - Max width for readability on wide screens
   ============================================ */

/* Limit main content width for better readability on ultra-wide monitors */
.fi-main-ctn {
    max-width: 1700px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ============================================
   HEADER ACTIONS - Wrap into multiple rows
   ============================================ */

/* Force header actions to wrap into multiple rows.
   Filament's header is sm:flex-row, so on wide screens
   the actions div gets enough room for all buttons on
   one line. We switch to column layout so the actions
   row spans full width, letting .fi-ac's flex-wrap work. */
.fi-resource-view-record-page .fi-header {
    flex-direction: column !important;
    align-items: flex-start !important;
}

.fi-resource-view-record-page .fi-header > div:last-child {
    width: 100% !important;
    flex-shrink: 1 !important;
}

.fi-resource-view-record-page .fi-header .fi-ac {
    justify-content: flex-start !important;
}

/* ============================================
   CUSTOMER UPDATE PENDING - Red highlighted row
   ============================================ */

/* Row-level background + left border */
tr.fi-ta-row.customer-update-pending,
tr.fi-ta-row.customer-update-pending:nth-child(odd),
tr.fi-ta-row.customer-update-pending:nth-child(even) {
    background-color: #fecaca !important;
    border-left: 4px solid #dc2626 !important;
}

tr.fi-ta-row.customer-update-pending:hover {
    background-color: #fca5a5 !important;
}

/* Also target all cells within the row to guarantee visibility */
tr.fi-ta-row.customer-update-pending > td,
tr.fi-ta-row.customer-update-pending > td.fi-ta-cell {
    background-color: #fecaca !important;
}

tr.fi-ta-row.customer-update-pending:hover > td,
tr.fi-ta-row.customer-update-pending:hover > td.fi-ta-cell {
    background-color: #fca5a5 !important;
}

/* Dark mode */
.dark tr.fi-ta-row.customer-update-pending,
.dark tr.fi-ta-row.customer-update-pending:nth-child(odd),
.dark tr.fi-ta-row.customer-update-pending:nth-child(even) {
    background-color: #7f1d1d !important;
    border-left: 4px solid #ef4444 !important;
}

.dark tr.fi-ta-row.customer-update-pending:hover {
    background-color: #991b1b !important;
}

.dark tr.fi-ta-row.customer-update-pending > td,
.dark tr.fi-ta-row.customer-update-pending > td.fi-ta-cell {
    background-color: #7f1d1d !important;
}

.dark tr.fi-ta-row.customer-update-pending:hover > td,
.dark tr.fi-ta-row.customer-update-pending:hover > td.fi-ta-cell {
    background-color: #991b1b !important;
}

/* ============================================
   SMS REPLY RECEIVED - Green highlighted row
   Uses .fi-ta-row for higher specificity to
   override Filament's Tailwind utility classes
   ============================================ */

tr.fi-ta-row.sms-reply-received,
tr.fi-ta-row.sms-reply-received:nth-child(odd),
tr.fi-ta-row.sms-reply-received:nth-child(even) {
    background-color: #d1fae5 !important;
    border-left: 4px solid #059669 !important;
}

tr.fi-ta-row.sms-reply-received:hover {
    background-color: #a7f3d0 !important;
}

tr.fi-ta-row.sms-reply-received > td,
tr.fi-ta-row.sms-reply-received > td.fi-ta-cell {
    background-color: #d1fae5 !important;
}

tr.fi-ta-row.sms-reply-received:hover > td,
tr.fi-ta-row.sms-reply-received:hover > td.fi-ta-cell {
    background-color: #a7f3d0 !important;
}

/* Dark mode */
.dark tr.fi-ta-row.sms-reply-received,
.dark tr.fi-ta-row.sms-reply-received:nth-child(odd),
.dark tr.fi-ta-row.sms-reply-received:nth-child(even) {
    background-color: #064e3b !important;
    border-left: 4px solid #10b981 !important;
}

.dark tr.fi-ta-row.sms-reply-received:hover {
    background-color: #065f46 !important;
}

.dark tr.fi-ta-row.sms-reply-received > td,
.dark tr.fi-ta-row.sms-reply-received > td.fi-ta-cell {
    background-color: #064e3b !important;
}

.dark tr.fi-ta-row.sms-reply-received:hover > td,
.dark tr.fi-ta-row.sms-reply-received:hover > td.fi-ta-cell {
    background-color: #065f46 !important;
}

/* When both SMS reply and customer update are active, red (customer update) takes priority.
   The green SMS icon column still shows so the reply is visible. */
tr.fi-ta-row.sms-reply-received.customer-update-pending,
tr.fi-ta-row.sms-reply-received.customer-update-pending:nth-child(odd),
tr.fi-ta-row.sms-reply-received.customer-update-pending:nth-child(even) {
    background-color: #fecaca !important;
    border-left: 4px solid #dc2626 !important;
}

tr.fi-ta-row.sms-reply-received.customer-update-pending > td,
tr.fi-ta-row.sms-reply-received.customer-update-pending > td.fi-ta-cell {
    background-color: #fecaca !important;
}

tr.fi-ta-row.sms-reply-received.customer-update-pending:hover,
tr.fi-ta-row.sms-reply-received.customer-update-pending:hover > td,
tr.fi-ta-row.sms-reply-received.customer-update-pending:hover > td.fi-ta-cell {
    background-color: #fca5a5 !important;
}

.dark tr.fi-ta-row.sms-reply-received.customer-update-pending,
.dark tr.fi-ta-row.sms-reply-received.customer-update-pending:nth-child(odd),
.dark tr.fi-ta-row.sms-reply-received.customer-update-pending:nth-child(even) {
    background-color: #7f1d1d !important;
    border-left: 4px solid #ef4444 !important;
}

.dark tr.fi-ta-row.sms-reply-received.customer-update-pending > td,
.dark tr.fi-ta-row.sms-reply-received.customer-update-pending > td.fi-ta-cell {
    background-color: #7f1d1d !important;
}

.dark tr.fi-ta-row.sms-reply-received.customer-update-pending:hover,
.dark tr.fi-ta-row.sms-reply-received.customer-update-pending:hover > td,
.dark tr.fi-ta-row.sms-reply-received.customer-update-pending:hover > td.fi-ta-cell {
    background-color: #991b1b !important;
}
