/**
 * ADR Performance Widget Table Styles
 *
 * This CSS file contains all styles for the ADR Performance Widget Table component.
 * Extracted from blade file to follow Blade Component Organization standards.
 */

/* ============================================
   TABLE WRAPPER & BASE STYLES
   ============================================ */
.adr-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 80vh !important;
    position: relative;
    border-radius: 0.5rem;
    border: 1px solid rgb(229 231 235);
    background: white;
    z-index: 1;
}

.dark .adr-table-wrapper {
    border-color: rgb(55 65 81);
    background: rgb(17 24 39);
}

.adr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ============================================
   TABLE HEADER STYLES
   ============================================ */
.adr-table thead th {
    position: sticky;
    background-color: #c5b191;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom-color: white;
    z-index: 10;
}

.adr-table thead tr:first-child th {
    top: 0;
    z-index: 12;
}

.adr-table thead tr:nth-child(2) th {
    top: 60px;
    z-index: 13;
    position: -webkit-sticky !important;
    position: sticky !important;
}

.dark .adr-table thead th {
    background-color: #c5b191;
    color: white;
    border-bottom-color: white;
}

/* ============================================
   TABLE CELL STYLES
   ============================================ */
.adr-table th,
.adr-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid rgb(243 244 246);
}

.dark .adr-table th,
.dark .adr-table td {
    border-bottom-color: rgb(31 41 55);
}

.adr-table tbody td {
    background-color: white;
    color: rgb(17 24 39);
}

.dark .adr-table tbody td {
    background-color: rgb(17 24 39);
    color: rgb(229 231 235);
}

.adr-table tbody tr:hover td {
    background-color: rgb(249 250 251);
}

.dark .adr-table tbody tr:hover td {
    background-color: rgb(31 41 55);
}

.adr-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   CELL STATUS COLORS BY MONTH
   ============================================ */
.adr-table tbody td.cell-status-success {
    background-color: rgb(240 253 244) !important;
}

.dark .adr-table tbody td.cell-status-success {
    background-color: rgb(20 83 45) !important;
}

.adr-table tbody tr:hover td.cell-status-success {
    background-color: rgb(220 252 231) !important;
}

.dark .adr-table tbody tr:hover td.cell-status-success {
    background-color: rgb(22 101 52) !important;
}

.adr-table tbody td.cell-status-warning {
    background-color: rgb(254 252 232) !important;
}

.dark .adr-table tbody td.cell-status-warning {
    background-color: rgb(120 53 15) !important;
}

.adr-table tbody tr:hover td.cell-status-warning {
    background-color: rgb(254 243 199) !important;
}

.dark .adr-table tbody tr:hover td.cell-status-warning {
    background-color: rgb(146 64 14) !important;
}

.adr-table tbody td.cell-status-danger {
    background-color: rgb(254 242 242) !important;
}

.dark .adr-table tbody td.cell-status-danger {
    background-color: rgb(127 29 29) !important;
}

.adr-table tbody tr:hover td.cell-status-danger {
    background-color: rgb(254 226 226) !important;
}

.dark .adr-table tbody tr:hover td.cell-status-danger {
    background-color: rgb(153 27 27) !important;
}

/* ============================================
   STICKY PROPERTY COLUMN
   ============================================ */
.adr-table th.col-property,
.adr-table td.col-property {
    position: sticky;
    left: 0;
    z-index: 5;
    text-align: left;
    min-width: 200px;
    font-weight: 600;
}

.adr-table th.col-property {
    background-color: #c5b191;
    color: white;
    box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.adr-table thead tr:first-child th.col-property {
    z-index: 21;
}

.adr-table thead tr:nth-child(2) th.col-property {
    z-index: 21;
}

.dark .adr-table th.col-property {
    background-color: #c5b191;
    color: white;
}

.adr-table tbody td.col-property {
    background-color: white;
    color: rgb(17 24 39);
    box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.1);
}

.dark .adr-table tbody td.col-property {
    background-color: rgb(17 24 39);
    color: rgb(229 231 235);
}

.adr-table tbody tr:hover td.col-property {
    background-color: rgb(249 250 251);
}

.dark .adr-table tbody tr:hover td.col-property {
    background-color: rgb(31 41 55);
}

/* ============================================
   PROPERTY NAME CONTAINER
   ============================================ */
.property-name-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.property-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.property-name-text {
    font-weight: 600;
}

.property-details {
    font-size: 0.7rem;
    color: #6b7280;
    font-weight: 400;
    margin-top: 2px;
}

.dark .property-details {
    color: #9ca3af;
}

/* ============================================
   EMAIL BUTTON STYLES
   ============================================ */
.email-button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    background-color: #c5b191;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.email-button:hover {
    background-color: #a89168;
    transform: scale(1.05);
}

.email-button:active {
    transform: scale(0.95);
}

.dark .email-button {
    background-color: #c5b191;
}

.dark .email-button:hover {
    background-color: #a89168;
}

.email-icon {
    width: 1.125rem;
    height: 1.125rem;
}

/* ============================================
   STICKY STATUS COLUMN
   ============================================ */
.adr-table th.col-status,
.adr-table td.col-status {
    position: sticky;
    left: 200px;
    z-index: 4;
    min-width: 100px;
}

.adr-table th.col-status {
    background-color: #c5b191;
    color: white;
    box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.1);
    z-index: 19;
}

.adr-table thead tr:first-child th.col-status {
    z-index: 20;
}

.adr-table thead tr:nth-child(2) th.col-status {
    z-index: 20;
}

.dark .adr-table th.col-status {
    background-color: #c5b191;
    color: white;
}

.adr-table tbody td.col-status {
    background-color: white;
    box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.1);
}

.dark .adr-table tbody td.col-status {
    background-color: rgb(17 24 39);
}

.adr-table tbody tr:hover td.col-status {
    background-color: rgb(249 250 251);
}

.dark .adr-table tbody tr:hover td.col-status {
    background-color: rgb(31 41 55);
}

/* ============================================
   MONTH GROUP STYLES
   ============================================ */
.month-group {
    background-color: #a89168;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.875rem 1rem;
}

.dark .month-group {
    background-color: #a89168;
    color: white;
}

.adr-table th.month-separator,
.adr-table td.month-separator {
    border-left: 3px solid white;
}

.dark .adr-table th.month-separator,
.dark .adr-table td.month-separator {
    border-left: 3px solid white;
}

/* ============================================
   TEXT STATUS COLORS
   ============================================ */
.text-success {
    color: rgb(22 163 74);
    font-weight: 600;
}

.dark .text-success {
    color: rgb(74 222 128);
}

.text-danger {
    color: rgb(220 38 38);
    font-weight: 600;
}

.dark .text-danger {
    color: rgb(248 113 113);
}

.text-warning {
    color: rgb(217 119 6);
    font-weight: 600;
}

.dark .text-warning {
    color: rgb(253 186 116);
}

/* ============================================
   STATUS DOT STYLES
   ============================================ */
.status-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    margin: 0 auto;
}

.status-success {
    background-color: rgb(220 252 231);
    color: rgb(22 163 74);
}

.dark .status-success {
    background-color: rgb(20 83 45);
    color: rgb(134 239 172);
}

.status-warning {
    background-color: rgb(254 243 199);
    color: rgb(217 119 6);
}

.dark .status-warning {
    background-color: rgb(120 53 15);
    color: rgb(253 186 116);
}

.status-danger {
    background-color: rgb(254 226 226);
    color: rgb(220 38 38);
}

.dark .status-danger {
    background-color: rgb(127 29 29);
    color: rgb(252 165 165);
}

.status-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* ============================================
   METRIC STYLES
   ============================================ */
.metric-value {
    font-weight: 600;
    color: rgb(17 24 39);
}

.dark .metric-value {
    color: rgb(229 231 235);
}

.metric-subtext {
    font-size: 0.75rem;
    color: rgb(107 114 128);
    margin-top: 0.125rem;
}

.dark .metric-subtext {
    color: rgb(156 163 175);
}

.metric-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex-wrap: nowrap;
}

.metric-inline .metric-value {
    white-space: nowrap;
}

.metric-inline .metric-subtext {
    margin-top: 0;
    white-space: nowrap;
}

.metric-inline .info-icon-container {
    display: inline-flex;
    flex-shrink: 0;
}

/* ============================================
   TOOLTIP STYLES
   ============================================ */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.info-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: rgb(156 163 175);
    cursor: help;
    flex-shrink: 0;
    transition: color 0.2s;
}

.info-icon:hover {
    color: rgb(99 102 241);
}

.dark .info-icon {
    color: rgb(107 114 128);
}

.dark .info-icon:hover {
    color: rgb(129 140 248);
}

.tooltip-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background-color: rgb(31 41 55);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 99999;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    white-space: normal;
    min-width: 200px;
    pointer-events: none;
    max-height: 400px;
    overflow-y: auto;
}

.dark .tooltip-content {
    background-color: rgb(55 65 81);
}

.info-icon-container {
    position: relative;
    display: inline-block;
}

.info-icon-container:hover .tooltip-content {
    display: block;
}

.tooltip-content::-webkit-scrollbar {
    width: 6px;
}

.tooltip-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.tooltip-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.tooltip-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.tooltip-list {
    list-style: decimal;
    padding-left: 1.25rem;
    margin: 0;
    text-align: left;
}

.tooltip-list li {
    margin: 0.25rem 0;
    line-height: 1.5;
}

/* ============================================
   WIDGET FILTER FORM
   ============================================ */
.widget-filter-form {
    margin-bottom: 1.5rem;
    position: relative;
}

.widget-filter-form .fi-fo-field-wrp,
.widget-filter-form .fi-select,
.widget-filter-form [x-data] {
    position: relative;
}

.fi-fo-select [role="listbox"],
[x-ref="panel"],
.fi-dropdown-panel {
    z-index: 999 !important;
}

/* ============================================
   EMAIL MODAL STYLES
   ============================================ */
.email-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    animation: fadeIn 0.2s ease-out;
}

.email-modal-overlay.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.email-modal {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
    position: relative;
    z-index: 99999;
}

.dark .email-modal {
    background: rgb(31 41 55);
}

.email-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgb(229 231 235);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dark .email-modal-header {
    border-bottom-color: rgb(55 65 81);
}

.email-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: rgb(17 24 39);
}

.dark .email-modal-title {
    color: rgb(229 231 235);
}

.email-modal-close {
    background: none;
    border: none;
    color: rgb(107 114 128);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.email-modal-close:hover {
    background: rgb(243 244 246);
    color: rgb(17 24 39);
}

.dark .email-modal-close:hover {
    background: rgb(55 65 81);
    color: rgb(229 231 235);
}

.email-modal-body {
    padding: 1.5rem;
}

.email-modal-section {
    margin-bottom: 1.5rem;
}

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

.email-modal-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(55 65 81);
    margin-bottom: 0.5rem;
}

.dark .email-modal-label {
    color: rgb(209 213 219);
}

.email-modal-info {
    padding: 1rem;
    background: rgb(249 250 251);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: rgb(55 65 81);
}

.dark .email-modal-info {
    background: rgb(55 65 81);
    color: rgb(209 213 219);
}

.email-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgb(229 231 235);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.dark .email-modal-footer {
    border-top-color: rgb(55 65 81);
}

.email-modal-button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.email-modal-button-cancel {
    background: white;
    color: rgb(55 65 81);
    border-color: rgb(209 213 219);
}

.email-modal-button-cancel:hover {
    background: rgb(249 250 251);
}

.dark .email-modal-button-cancel {
    background: rgb(55 65 81);
    color: rgb(209 213 219);
    border-color: rgb(75 85 99);
}

.dark .email-modal-button-cancel:hover {
    background: rgb(75 85 99);
}

.email-modal-button-send {
    background: #c5b191;
    color: white;
    border-color: #c5b191;
}

.email-modal-button-send:hover {
    background: #a89168;
    border-color: #a89168;
}

.email-modal-button-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   USER SEARCH & SELECTION STYLES
   ============================================ */
.user-search-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid rgb(229 231 235);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: rgb(17 24 39);
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}

.user-search-input:focus {
    outline: none;
    border-color: #c5b191;
    box-shadow: 0 0 0 3px rgba(197, 177, 145, 0.1);
}

.dark .user-search-input {
    background: rgb(31 41 55);
    border-color: rgb(55 65 81);
    color: rgb(229 231 235);
}

.dark .user-search-input:focus {
    border-color: #c5b191;
}

.user-selection-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgb(229 231 235);
    border-radius: 0.375rem;
    padding: 0.5rem;
}

.dark .user-selection-list {
    border-color: rgb(55 65 81);
}

.user-selection-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.2s;
}

.user-selection-item:hover {
    background: rgb(249 250 251);
}

.dark .user-selection-item:hover {
    background: rgb(55 65 81);
}

.user-selection-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: #c5b191;
}

.user-selection-label {
    flex: 1;
    font-size: 0.875rem;
    color: rgb(17 24 39);
    cursor: pointer;
}

.dark .user-selection-label {
    color: rgb(229 231 235);
}

.user-selection-email {
    font-size: 0.75rem;
    color: rgb(107 114 128);
    margin-top: 0.125rem;
}

.dark .user-selection-email {
    color: rgb(156 163 175);
}

.selected-users-count {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #c5b191;
    color: white;
    border-radius: 9999px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* ============================================
   AVERAGE ROW STYLES
   ============================================ */
.average-row {
    background-color: #6b7280 !important;
    font-weight: 600;
    border-top: 2px solid #4b5563;
    border-bottom: 2px solid #4b5563;
}

.dark .average-row {
    background-color: #4b5563 !important;
    border-top-color: #374151;
    border-bottom-color: #374151;
}

.average-row td {
    background-color: #6b7280 !important;
    color: white !important;
    padding: 1rem !important;
}

.dark .average-row td {
    background-color: #4b5563 !important;
    color: white !important;
}

.average-row:hover td {
    background-color: #4b5563 !important;
    color: white !important;
}

.dark .average-row:hover td {
    background-color: #374151 !important;
    color: white !important;
}

.average-row .col-property {
    font-weight: 700;
    font-style: italic;
    color: white !important;
    background-color: #6b7280 !important;
}

.dark .average-row .col-property {
    color: white !important;
    background-color: #4b5563 !important;
}

.average-row .col-status {
    background-color: #6b7280 !important;
}

.dark .average-row .col-status {
    background-color: #4b5563 !important;
}

.average-row td.cell-status-success,
.average-row td.cell-status-warning,
.average-row td.cell-status-danger {
    background-color: #6b7280 !important;
    color: white !important;
}

.dark .average-row td.cell-status-success,
.dark .average-row td.cell-status-warning,
.dark .average-row td.cell-status-danger {
    background-color: #4b5563 !important;
    color: white !important;
}

.average-row:hover td.cell-status-success,
.average-row:hover td.cell-status-warning,
.average-row:hover td.cell-status-danger {
    background-color: #4b5563 !important;
    color: white !important;
}

.dark .average-row:hover td.cell-status-success,
.dark .average-row:hover td.cell-status-warning,
.dark .average-row:hover td.cell-status-danger {
    background-color: #374151 !important;
    color: white !important;
}

.average-row .metric-value,
.average-row .metric-subtext {
    color: white !important;
}

.dark .average-row .metric-value,
.dark .average-row .metric-subtext {
    color: white !important;
}

.average-row .text-success,
.average-row .text-danger,
.average-row .text-warning {
    color: white !important;
}

.dark .average-row .text-success,
.dark .average-row .text-danger,
.dark .average-row .text-warning {
    color: white !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   EXPORT PDF BUTTON
   ============================================ */
.export-pdf-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    background-color: #c5b191;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.export-pdf-button:hover {
    background-color: #a89168;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.export-pdf-button:active {
    transform: translateY(0);
}

.export-pdf-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.export-pdf-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.dark .export-pdf-button {
    background-color: #c5b191;
}

.dark .export-pdf-button:hover {
    background-color: #a89168;
}
