/* ============================================================
   GestorOT - Global Styles
   ============================================================ */

:root {
    --bg-dark: #0F0F1A;
    --bg-card: #1E1E2E;
    --primary: #E74C3C;
    --secondary: #C0392B;
    --text-main: rgba(255, 255, 255, 0.85);
    --text-dim: rgba(255, 255, 255, 0.45);
    --text-primary: #E0E0E0;
    --text-secondary: #A0A0A0;
    --text-muted: #666680;
}

/* AntDesign overrides */
.ant-picker, .ant-picker input,
.ant-select-selection-item,
.ant-input-number,
.ant-input-number-input,
.ant-input,
.ant-select-selection-placeholder,
.ant-picker-input > input::placeholder,
.ant-input-number-handler-wrap,
.ant-input-affix-wrapper,
.ant-input-affix-wrapper input {
  color: #ffffff !important;
  background-color: transparent !important;
}

.ant-form-item-label > label, 
.ant-modal-title,
.ant-card-head-title,
.ant-progress-text {
  color: #FFFFFF !important;
}

.ant-select-arrow, .ant-select-clear {
  color: var(--text-dim) !important;
}

.ant-radio-wrapper {
  color: var(--text-primary) !important;
}

.ant-divider-inner-text {
  color: var(--text-primary) !important;
}

.ant-collapse-header-text, .ant-collapse-expand-icon {
  color: var(--text-primary) !important;
}

/* AntDesign Buttons Dark Theme Overrides */
.ant-btn {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: var(--text-primary) !important;
}

.ant-btn:hover, .ant-btn:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}

.ant-btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.ant-btn-primary:hover, .ant-btn-primary:focus {
    background-color: var(--secondary) !important;
    border-color: var(--secondary) !important;
    color: #fff !important;
}

.ant-btn[disabled], .ant-btn-primary[disabled] {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.3) !important;
}

.ant-btn-text, .ant-btn-link, .ant-btn-ghost {
    background-color: transparent !important;
    border-color: transparent !important;
}

.ant-btn-text:hover, .ant-btn-ghost:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: transparent !important;
}

.ant-btn-dangerous {
    background-color: rgba(231, 76, 60, 0.1) !important;
    border-color: rgba(231, 76, 60, 0.3) !important;
    color: #E74C3C !important;
}

.ant-btn-dangerous:hover {
    background-color: rgba(231, 76, 60, 0.2) !important;
    border-color: #E74C3C !important;
    color: #E74C3C !important;
}

.ant-btn-primary.ant-btn-dangerous {
    background-color: #E74C3C !important;
    border-color: #E74C3C !important;
    color: #fff !important;
}

.ant-btn-primary.ant-btn-dangerous:hover {
    background-color: #C0392B !important;
    border-color: #C0392B !important;
}

.ant-tag {
    color: #fff !important;
    border: none !important;
    font-weight: 600 !important;
    padding: 2px 10px !important;
    border-radius: 12px !important;
}

/* AntDesign Tag semantic colors overrides for dark theme */
.ant-tag-processing, .ant-tag-blue, .ant-tag-geekblue {
    background: #1890FF !important;
}

.ant-tag-purple, .ant-tag-magenta {
    background: #722ED1 !important;
}

.ant-tag-warning, .ant-tag-orange, .ant-tag-gold {
    background: #FAAD14 !important;
}

.ant-tag-success, .ant-tag-green {
    background: #52C41A !important;
}

.ant-tag-error, .ant-tag-red {
    background: #F5222D !important;
}

.ant-tag-default {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* Ensure tooltips are readable */
.ant-tooltip-inner {
    background-color: #31314d !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
}

.ant-tooltip-arrow-content {
    background-color: #31314d !important;
}

/* Ensure no black text in any input or form element */
input, textarea, select {
    color: var(--text-primary) !important;
}

::placeholder {
    color: var(--text-dim) !important;
}

.ant-divider-inner-text {
  color: var(--text-primary) !important;
}

.ant-radio-wrapper {
  color: var(--text-primary) !important;
}

.ant-collapse-header-text, .ant-collapse-expand-icon {
  color: var(--text-primary) !important;
}

.ant-collapse-content {
  background-color: rgba(255, 255, 255, 0.02) !important;
  color: var(--text-primary) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.ant-collapse > .ant-collapse-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.ant-collapse {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* General AntDesign Content Backround Fix */
.ant-timeline-item-content {
  color: var(--text-primary) !important;
}

.ant-popover-inner, .ant-popover-inner-content, .ant-popover-arrow-content {
  background-color: var(--bg-card) !important;
  color: #ffffff !important;
}

.ant-popover-title {
  color: #ffffff !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.ant-modal-content, .ant-modal-header {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.ant-drawer-content, .ant-drawer-header {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.ant-dropdown-menu {
  background-color: var(--bg-card) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.ant-dropdown-menu-item {
  color: var(--text-primary) !important;
}

.ant-dropdown-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Fix for Tabs white background */
.ant-tabs, .ant-tabs-nav, .ant-tabs-content, .ant-tabs-tabpane {
    background: transparent !important;
    color: var(--text-primary) !important;
}

.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--text-dim) !important;
}

.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab-active {
  background: #1E1E2E !important;
  color: #fff !important;
  border-bottom: 1px solid #1E1E2E !important;
}

.ant-tabs-nav-list {
    background: transparent !important;
}

.ant-tabs-ink-bar {
    background: #E74C3C !important;
}

/* Fix for KPI Card in WorkOrderDetail */
.kpi-card-new {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.kpi-card-new .kpi-label {
    color: var(--text-dim) !important;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.kpi-card-new .kpi-value {
    color: #fff !important;
    font-size: 24px;
    font-weight: 700;
}

/* Ensure no white background in cards or sections */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

/* Barra de búsqueda/filtros arriba de las tablas */
/* Barra estándar de las tablas (RemoteTable): búsqueda, filtros, opciones y herramientas a la derecha. */
.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.table-toolbar-tools {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.table-toolbar-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
}

/* AntDesign Table improvements */
.ant-table {
    color: var(--text-primary) !important;
}

.ant-table-thead > tr > th {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-secondary) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.ant-table-tbody > tr > td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
}

.ant-table-tbody > tr.ant-table-row:hover > td, 
.ant-table-tbody > tr > td.ant-table-cell-row-hover {
    background: rgba(255, 255, 255, 0.02) !important;
}

.ant-table-tbody > tr.ant-table-row-selected > td,
.ant-table-tbody > tr.ant-table-row-selected:hover > td {
    background: rgba(52, 152, 219, 0.15) !important;
}

/* Fix for Fixed Columns white background */
.ant-table-cell-fix-left,
.ant-table-cell-fix-right,
.ant-table-cell-fix-left-first,
.ant-table-cell-fix-left-last,
.ant-table-cell-fix-right-first,
.ant-table-cell-fix-right-last {
    background-color: var(--bg-card) !important;
}

.ant-table-thead > tr > th.ant-table-cell-fix-left,
.ant-table-thead > tr > th.ant-table-cell-fix-right,
.ant-table-thead > tr > th.ant-table-cell-fix-left-first,
.ant-table-thead > tr > th.ant-table-cell-fix-left-last,
.ant-table-thead > tr > th.ant-table-cell-fix-right-first,
.ant-table-thead > tr > th.ant-table-cell-fix-right-last {
    background-color: #28283C !important;
}

.ant-table-tbody > tr.ant-table-row:hover > td.ant-table-cell-fix-left,
.ant-table-tbody > tr.ant-table-row:hover > td.ant-table-cell-fix-right,
.ant-table-tbody > tr.ant-table-row:hover > td.ant-table-cell-fix-left-first,
.ant-table-tbody > tr.ant-table-row:hover > td.ant-table-cell-fix-left-last,
.ant-table-tbody > tr.ant-table-row:hover > td.ant-table-cell-fix-right-first,
.ant-table-tbody > tr.ant-table-row:hover > td.ant-table-cell-fix-right-last {
    background-color: #252538 !important;
}


/* Fix for Expanded Rows white background */
.ant-table-expanded-row > .ant-table-cell,
.ant-table-expanded-row:hover > .ant-table-cell,
.ant-table-expanded-row-fixed,
.ant-table-expanded-row-fixed::after,
.ant-table-expand-icon-cell {
  background: #1E1E2E !important;
  background-color: #1E1E2E !important;
}

.ant-table-wrapper .ant-table-expanded-row-fixed {
  margin: -16px -16px;
}

/* Ensure the inner content of expand doesn't have default light theme backgrounds */
.ant-table-expanded-row .ant-table-content,
.ant-table-expanded-row .ant-table {
  background: transparent !important;
}

.ant-table-expanded-row .ant-table-thead > tr > th {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-secondary) !important;
}

.ant-table-expanded-row .ant-table-tbody > tr > td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.ant-collapse-content-box {
  background-color: transparent !important;
}

.ant-collapse-item {
  background-color: transparent !important;
}

.ant-collapse-content {
  background-color: rgba(255, 255, 255, 0.02) !important;
  color: var(--text-primary) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.ant-table-expanded-row-fixed::after {
  border-width: 0 !important;
}

/* Ensure child tables also look dark */
.ant-table-expanded-row .ant-table {
  background: transparent !important;
}

.ant-table-expanded-row .ant-table-thead > tr > th {
  background: rgba(255, 255, 255, 0.05) !important;
}

.ant-form-item-label > label {
  color: var(--text-secondary) !important;
}

/* Calendarios internos del DatePicker */
.ant-picker-calendar-date-value,
.ant-picker-cell-inner {
  color: var(--text-primary) !important;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

body {
    /* Un degradado radial sutil para dar profundidad */
    background: radial-gradient(circle at 50% 50%, #1A1A2E 0%, #0F0F1A 100%);
    background-attachment: fixed;
}

/* Scrollbar personalizado para que no rompa el diseño oscuro */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(231, 76, 60, 0.3);
}

h1, h2, h3, h4, h5, h6 {
    color: #FFFFFF;
}

/* AntDesign DatePicker Header Contrast Fix (ISSUE-01) */
.ant-picker-header button,
.ant-picker-header-super-prev-btn,
.ant-picker-header-prev-btn,
.ant-picker-header-next-btn,
.ant-picker-header-super-next-btn {
    color: rgba(255, 255, 255, 0.75) !important;
}

.ant-picker-header button:hover {
    color: #ffffff !important;
}
