/**
 * mot.css — Módulo de Monitor de Técnicos
 * @version 1.6.0
 * @author Equipo ERP
 * @date 2026-08-15
 */

.mot-page {
    --mot-primary: #1f3b5b;
    --mot-accent: #f59e0b;
    --mot-border: #e5eaf0;
    --mot-muted: #718096;
    --mot-surface: #ffffff;
    --mot-background: #f5f7fa;
    background: var(--mot-background);
    min-height: calc(100vh - 57px);
}

.mot-header {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 18px;
    overflow-x: auto;
    padding: 12px 22px;
}

.mot-heading {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.mot-heading-icon {
    color: #007bff;
    flex: 0 0 auto;
    font-size: 1.45rem;
}

.mot-heading h1 {
    color: #1d2939;
    flex: 0 0 auto;
    font-size: 1.5rem;
    font-weight: 300;
    margin: 0;
}

.mot-heading p {
    color: var(--mot-muted);
    font-size: .88rem;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mot-eyebrow {
    color: #d97706;
    flex: 0 0 auto;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.mot-clock {
    color: #1d2939;
    display: inline-block;
    flex: 0 0 auto;
    font-family: "Roboto Mono", "Courier New", monospace;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: .045em;
    line-height: 1;
    white-space: nowrap;
}

.mot-content { padding: 0 22px 24px; }

.mot-toolbar {
    align-items: center;
    background: var(--mot-surface);
    border: 1px solid var(--mot-border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .045);
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 12px;
}

.mot-week-navigation,
.mot-filters,
.mot-status-filters {
    align-items: center;
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.mot-week-navigation { flex: 0 0 auto; }

.mot-week-navigation .btn {
    min-width: 34px;
    padding: .29rem .58rem;
}

.mot-week-navigation .btn-warning {
    color: #6b4100;
    font-weight: 700;
}

.mot-week-label {
    color: #344054;
    font-size: .84rem;
    font-weight: 800;
    min-width: 120px;
    text-align: center;
    text-transform: capitalize;
}

.mot-filters {
    flex: 1 0 800px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: 800px;
}

.mot-filters > select:not(#motStations) {
    flex: 0 0 145px;
    min-width: 0;
    width: 145px;
}

.mot-filters #motSource {
    flex-basis: 120px;
    width: 120px;
}

.mot-filters #motServiceType {
    flex-basis: 145px;
    width: 145px;
}

.mot-filters #motGroup {
    flex-basis: 140px;
    width: 140px;
}

.mot-filters > #motStations,
.mot-filters > .select2-container {
    flex: 1 1 250px;
    max-width: 310px;
    min-width: 250px;
    width: 100% !important;
}

.mot-filters > .select2-container .select2-selection--single {
    border-color: #ced4da;
    height: 31px;
}

.mot-filters > .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 26px;
    padding-left: 8px;
}

.mot-filters > .select2-container .select2-selection--single .select2-selection__arrow {
    height: 29px;
}

.mot-status-filters {
    color: #667085;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    font-size: .76rem;
    font-weight: 700;
    margin: 0;
}

.mot-status-filter {
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 999px;
    color: #667085;
    cursor: pointer;
    font-size: .71rem;
    font-weight: 700;
    padding: 4px 8px;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.mot-status-filter:hover,
.mot-status-filter.is-active {
    background: var(--mot-primary);
    border-color: var(--mot-primary);
    color: #fff;
}

.mot-metrics {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    margin-top: 12px;
    margin-bottom: 12px;
}

.mot-metric-card {
    background: var(--mot-surface);
    border: 1px solid var(--mot-border);
    border-radius: 10px;
    border-top: 3px solid var(--mot-primary);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    padding: 10px 13px;
}

.mot-metric-card span {
    color: var(--mot-muted);
    display: block;
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.mot-metric-card strong {
    color: #1d2939;
    display: block;
    font-size: 1.35rem;
    line-height: 1.1;
    margin-top: 3px;
}

.mot-metric-card--warning { border-top-color: #f59e0b; }
.mot-metric-card--warning strong { color: #b45309; }
.mot-metric-card--success { border-top-color: #16a34a; }
.mot-metric-card--success strong { color: #15803d; }
.mot-metric-card--info { border-top-color: #0ea5e9; }
.mot-metric-card--info strong { color: #0369a1; }

.mot-calendar-shell {
    background: var(--mot-surface);
    border: 1px solid var(--mot-border);
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .05);
    height: clamp(300px, calc(100vh - 295px), 660px);
    overflow: auto;
    overscroll-behavior: contain;
    position: relative;
    scrollbar-gutter: stable;
    transition: height .2s ease;
}

.mot-calendar {
    transition: filter .2s ease, opacity .2s ease;
}

.mot-calendar-shell.is-loading .mot-calendar {
    filter: blur(1.5px);
    opacity: .43;
}

.mot-loading-overlay {
    align-items: center;
    background: rgba(248, 250, 252, .42);
    display: flex;
    inset: 0;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity .18s ease;
    z-index: 20;
}

.mot-calendar-shell.is-loading .mot-loading-overlay { opacity: 1; }

.mot-loading-card {
    align-items: center;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(37, 99, 235, .2);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
    display: flex;
    gap: 11px;
    max-width: min(420px, calc(100% - 32px));
    padding: 12px 16px 12px 12px;
}

.mot-loading-orbit {
    align-items: center;
    animation: mot-loading-orbit 1.35s linear infinite;
    background: #e8f1ff;
    border-radius: 50%;
    color: #2563eb;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .95rem;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.mot-loading-copy {
    display: grid;
    line-height: 1.2;
    min-width: 0;
}

.mot-loading-copy strong { color: #1d2939; font-size: .8rem; font-weight: 800; }
.mot-loading-copy small { color: #64748b; font-size: .69rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mot-loading-dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.mot-loading-dots i { animation: mot-loading-dot 1s ease-in-out infinite; background: #2563eb; border-radius: 50%; display: block; height: 5px; opacity: .35; width: 5px; }
.mot-loading-dots i:nth-child(2) { animation-delay: .15s; }
.mot-loading-dots i:nth-child(3) { animation-delay: .3s; }

@keyframes mot-loading-orbit { to { transform: rotate(360deg); } }
@keyframes mot-loading-dot { 50% { opacity: 1; transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
    .mot-calendar,
    .mot-loading-overlay { transition: none; }
    .mot-loading-orbit,
    .mot-loading-dots i { animation: none; }
}

.mot-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(178px, 1fr));
    min-height: 100%;
    min-width: 1246px;
}

.mot-calendar-loading,
.mot-calendar-error {
    align-items: center;
    color: var(--mot-muted);
    display: flex;
    flex-direction: column;
    font-size: .88rem;
    gap: 10px;
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 390px;
}

.mot-calendar-error i { color: #dc2626; font-size: 1.5rem; }

.mot-day {
    border-right: 1px solid #edf1f5;
    min-width: 0;
}

.mot-day:last-child { border-right: 0; }

.mot-day-header {
    align-items: baseline;
    border-bottom: 1px solid #edf1f5;
    display: flex;
    gap: 7px;
    justify-content: space-between;
    min-height: 74px;
    padding: 13px 12px 10px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--mot-surface);
}

.mot-day.is-today .mot-day-header {
    background: #fffbeb;
    box-shadow: inset 0 -2px 0 #f59e0b;
}

.mot-day-name {
    color: #98a2b3;
    display: block;
    font-size: .63rem;
    font-weight: 800;
    letter-spacing: .05em;
}

.mot-day-number {
    color: #344054;
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 2px;
}

.mot-day-month { color: #98a2b3; font-size: .65rem; text-transform: capitalize; }

.mot-day-total {
    align-items: center;
    background: #1d2939;
    border-radius: 99px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .92rem;
    font-weight: 900;
    height: 28px;
    justify-content: center;
    line-height: 1;
    min-width: 28px;
    padding: 0 6px;
}

.mot-day-events { padding: 9px; }

.mot-entry {
    background: #fff;
    border: 1px solid #e7ecf2;
    border-left: 3px solid #64748b;
    border-radius: 7px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .045);
    margin-bottom: 8px;
    overflow: hidden;
    padding: 8px;
}

.mot-entry--rsx { border-left-color: #2563eb; }
.mot-entry--nrx { border-left-color: #7c3aed; }
.mot-entry--draft { border-left-color: #f59e0b; }

.mot-entry-top,
.mot-entry-title-row {
    align-items: center;
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.mot-entry-time {
    color: #1d2939;
    font-size: .86rem;
    font-weight: 900;
    letter-spacing: .01em;
    line-height: 1;
}

.mot-entry-badge,
.mot-entry-service-type {
    border-radius: 999px;
    font-size: .58rem;
    font-weight: 800;
    line-height: 1;
    padding: 3px 5px;
    white-space: nowrap;
}

.mot-entry-badge--draft { background: #fef3c7; color: #a16207; }
.mot-entry-badge--finalized { background: #dcfce7; color: #15803d; }

.mot-entry-title-row { margin-top: 7px; }

.mot-entry-service-type {
    color: #fff;
    font-size: .64rem;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
}

.mot-entry-service-type--preventivo { background: #007bff; }
.mot-entry-service-type--correctivo { background: #dc3545; }
.mot-entry-service-type--nrx { background: #17a2b8; }
.mot-entry-service-type--default { background: #17a2b8; }

.mot-entry-pdf {
    align-items: center;
    background: #fff0f0;
    border: 0;
    border-radius: 6px;
    color: #dc3545;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .76rem;
    height: 25px;
    justify-content: center;
    padding: 0;
    transition: background .15s ease, transform .15s ease;
    width: 25px;
}

.mot-entry-pdf:hover {
    background: #ffe0e0;
    transform: scale(1.06);
}

.mot-entry-place,
.mot-entry-technician {
    color: #667085;
    font-size: .64rem;
    line-height: 1.35;
    margin-top: 5px;
}

.mot-entry-place i,
.mot-entry-technician i { color: #98a2b3; margin-right: 3px; width: 10px; }

.mot-entry-place {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mot-entry-technician {
    overflow-wrap: anywhere;
    white-space: normal;
}

.mot-day-empty {
    color: #c0c9d4;
    font-size: .68rem;
    padding: 18px 3px;
    text-align: center;
}

@media (max-width: 850px) {
    .mot-heading p { display: none; }
    .mot-toolbar { padding: 10px; }
}

@media (max-width: 600px) {
    .mot-header { padding: 16px 14px 10px; }
    .mot-header h1 { font-size: 1.18rem; }
    .mot-content { padding: 0 14px 18px; }
    .mot-metrics { grid-template-columns: repeat(2, 1fr); }
    .mot-week-label { min-width: 112px; }
}

@media (max-width: 420px) {
    .mot-eyebrow { display: none; }
}
