/*
 * Estilos propios del portal, encima de Bootstrap 5.
 * Sin build: este archivo se sirve tal cual desde public/ (RD-43).
 *
 * Los colores de la organización llegan como variables CSS desde el layout:
 * --mc-primary, --mc-secondary, --mc-on-primary.
 */

:root {
    --mc-primary: #0d6efd;
    --mc-secondary: #6c757d;
    --mc-on-primary: #ffffff;
    --mc-surface: #ffffff;
    --mc-ground: #f5f6f8;
    --mc-line: #dee2e6;
    --mc-ink: #212529;
    --mc-ink-soft: #5c636a;
}

body {
    background: var(--mc-ground);
    color: var(--mc-ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
}

/* ── Pantallas previas al ingreso ─────────────────────────────── */

.mc-guest {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.mc-guest__panel {
    width: 100%;
    max-width: 26rem;
}

.mc-guest__card {
    background: var(--mc-surface);
    border: 1px solid var(--mc-line);
    border-radius: 0.5rem;
    padding: 2rem;
}

.mc-guest__brand {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1.5rem;
    text-align: center;
}

.mc-guest__footer {
    color: var(--mc-ink-soft);
    font-size: 0.85rem;
    margin: 1.5rem 0 0;
    text-align: center;
}

/* ── Barra superior con la marca de la organización ───────────── */

.mc-topbar {
    background: var(--mc-primary);
    color: var(--mc-on-primary);
}

.mc-topbar__inner {
    align-items: center;
    display: flex;
    gap: 1.5rem;
    margin: 0 auto;
    max-width: 75rem;
    min-height: 3.75rem;
    padding: 0.5rem 1rem;
}

.mc-topbar__logo {
    display: block;
    max-height: 40px;
    width: auto;
}

.mc-topbar__name {
    font-size: 1.05rem;
    font-weight: 600;
}

.mc-topbar__links {
    display: flex;
    gap: 1rem;
    margin-inline-start: auto;
}

.mc-topbar__links a {
    color: var(--mc-on-primary);
    font-size: 0.9rem;
    opacity: 0.9;
    text-decoration: none;
}

.mc-topbar__links a:hover,
.mc-topbar__links a:focus-visible {
    opacity: 1;
    text-decoration: underline;
}

.mc-topbar__user-button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--mc-on-primary);
}

.mc-topbar__user-button:hover,
.mc-topbar__user-button:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    color: var(--mc-on-primary);
}

/* ── Contenido y pie ──────────────────────────────────────────── */

.mc-main {
    margin: 0 auto;
    max-width: 75rem;
    padding: 1.5rem 1rem 3rem;
}

.mc-footer {
    border-top: 1px solid var(--mc-line);
    color: var(--mc-ink-soft);
    font-size: 0.85rem;
    margin: 0 auto;
    max-width: 75rem;
    padding: 1rem;
    text-align: center;
}

.mc-card {
    background: var(--mc-surface);
    border: 1px solid var(--mc-line);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.mc-empty {
    padding: 3rem 1rem;
    text-align: center;
}

.mc-empty__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
}

.mc-empty__body {
    color: var(--mc-ink-soft);
    margin: 0;
}

/* Botón principal con los colores de la organización. */
.mc-btn-primary {
    background: var(--mc-primary);
    border: 1px solid var(--mc-primary);
    color: var(--mc-on-primary);
}

.mc-btn-primary:hover,
.mc-btn-primary:focus-visible {
    background: var(--mc-primary);
    color: var(--mc-on-primary);
    filter: brightness(0.92);
}

.mc-page-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.mc-page-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
}

@media (max-width: 767.98px) {
    .mc-topbar__inner {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .mc-topbar__links {
        margin-inline-start: 0;
        order: 3;
        width: 100%;
    }

    .mc-topbar__user {
        margin-inline-start: auto;
    }
}

/* ── Formularios dinámicos y selector de tipos (hito 1.2) ─────────────────── */

.mc-page-header__intro {
    color: #5c636a;
    flex-basis: 100%;
    margin: 0;
}

.mc-type-group {
    margin-bottom: 1.75rem;
}

.mc-type-group__title {
    color: #5c636a;
    margin-bottom: 0.75rem;
    text-transform: none;
}

/* Tarjeta de tipo: toda la tarjeta es el enlace, no solo el título, para que
   en un teléfono el área tocable sea la que se ve. */
.mc-type-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
    padding: 1rem;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mc-type-card:hover,
.mc-type-card:focus-visible {
    border-color: var(--mc-primary);
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

.mc-type-card__name {
    font-weight: 600;
}

.mc-type-card__description {
    color: #5c636a;
    font-size: 0.9rem;
}

.mc-back-link {
    color: #5c636a;
    flex-basis: 100%;
    font-size: 0.9rem;
}

.mc-required {
    color: #b02a37;
    margin-inline-start: 0.15rem;
}

.mc-check-list {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    max-height: 15rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
}

.mc-fieldset {
    border-top: 1px solid #dee2e6;
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.mc-fieldset legend {
    float: none;
    margin-bottom: 0.75rem;
    width: auto;
}

.mc-form-actions {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.mc-summary {
    display: grid;
    gap: 0.25rem 1rem;
    grid-template-columns: minmax(8rem, 14rem) 1fr;
    margin: 0;
}

.mc-summary dt {
    color: #5c636a;
    font-weight: 500;
}

.mc-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.mc-template-link {
    margin-inline-end: 0.35rem;
}

/* Vista previa dentro del panel: se acota para que las hojas de Bootstrap y de
   Filament no se pisen fuera del recuadro. */
.mc-preview__frame {
    background: #fff;
    border-radius: 0.5rem;
    color: #212529;
    padding: 1rem;
}

@media (max-width: 575.98px) {
    .mc-summary {
        grid-template-columns: 1fr;
    }

    .mc-summary dd {
        margin-bottom: 0.5rem;
    }

    .mc-form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}

/* ── Tabla y detalle de solicitudes (hito 1.3) ───────────────────────────── */

.mc-filters {
    margin-bottom: 1.25rem;
}

.mc-filters__panel {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.mc-filters__summary {
    cursor: pointer;
    font-weight: 600;
}

.mc-filters__fields {
    margin-top: 0.75rem;
}

.mc-status-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.mc-table-card {
    padding: 0;
}

.mc-table {
    margin: 0;
}

.mc-table thead th {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: none;
    white-space: nowrap;
}

.mc-table thead th a {
    color: #5c636a;
    text-decoration: none;
}

.mc-table thead th a:hover {
    color: var(--mc-primary);
}

.mc-row__link {
    font-weight: 600;
    text-decoration: none;
}

/* Cancelada o rechazada: tachada y atenuada, pero legible. */
.mc-row--cancelled td,
.mc-row--cancelled .mc-request-card__type {
    color: #6c757d;
    text-decoration: line-through;
}

.mc-row--cancelled .mc-badge {
    text-decoration: none;
}

/* La fila recién creada se resalta un momento para que la persona la
   encuentre sin buscarla. */
.mc-row--new {
    animation: mc-highlight 3s ease-out;
}

@keyframes mc-highlight {
    from { background-color: rgba(255, 243, 205, 1); }
    to { background-color: transparent; }
}

.mc-badge {
    border-radius: 1rem;
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
}

.mc-badge--pending { background: #e9ecef; color: #343a40; }
.mc-badge--accepted { background: #cfe2ff; color: #084298; }
.mc-badge--in-progress { background: #b6d4fe; color: #052c65; }
.mc-badge--waiting { background: #fff3cd; color: #664d03; }
.mc-badge--completed { background: #d1e7dd; color: #0a3622; }
.mc-badge--cancelled { background: #ced4da; color: #212529; }
.mc-badge--rejected { background: #f8d7da; color: #58151c; }

.mc-execution--overdue {
    color: #b02a37;
    font-weight: 600;
}

.mc-execution--closed {
    color: #6c757d;
}

/* Teléfono: la misma información como tarjeta. Una tabla de siete columnas en
   390 px no se lee. */
.mc-request-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
}

.mc-request-card__head {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

.mc-request-card__type {
    font-size: 0.95rem;
}

.mc-request-card__meta {
    color: #5c636a;
    font-size: 0.85rem;
}

.mc-pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: 1rem;
}

.mc-pagination__count {
    color: #5c636a;
    font-size: 0.9rem;
    margin: 0;
}

.mc-preserve-lines {
    white-space: pre-line;
}

.mc-attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mc-attachment-list li {
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.mc-attachment-list li:last-child {
    border-bottom: 0;
}

/* Historial: una línea de tiempo simple, sin adornos que compitan con el
   contenido. */
.mc-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mc-timeline__item {
    border-inline-start: 2px solid #dee2e6;
    padding: 0 0 1rem 1rem;
    position: relative;
}

.mc-timeline__item:last-child {
    border-inline-start-color: transparent;
    padding-bottom: 0;
}

.mc-timeline__item::before {
    background: var(--mc-primary);
    border-radius: 50%;
    content: '';
    height: 0.5rem;
    inset-inline-start: -0.3rem;
    position: absolute;
    top: 0.35rem;
    width: 0.5rem;
}

.mc-timeline__when {
    color: #5c636a;
    display: block;
    font-size: 0.82rem;
}

.mc-timeline__note {
    color: #664d03;
    display: block;
    font-size: 0.88rem;
}

.mc-changes {
    font-size: 0.88rem;
    margin-top: 0.5rem;
}

/* ── Pedidos del cliente y estados (hito 1.4) ────────────────────────────── */

/* El pedido pendiente se destaca: es lo que cambia qué puede hacer la persona
   en esta pantalla. */
.mc-card--pending {
    border-inline-start: 4px solid #ffc107;
}

.mc-explain {
    color: #5c636a;
    margin: 1rem 0 0;
}

.mc-badge--change {
    background: #fff3cd;
    color: #664d03;
    margin-inline-start: 0.35rem;
}

/* Hilo de comentarios (RD-29). Los del proveedor con otro fondo para que la
   conversación se lea de un vistazo, sin tener que leer los nombres. */
.mc-thread {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mc-thread__item {
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 10px 12px;
}

.mc-thread__item--provider {
    background: #e7f1ff;
}

.mc-thread__who {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin: 0 0 4px;
}

.mc-thread__when {
    color: #6c757d;
    font-size: 0.85rem;
}

.mc-thread__body {
    margin: 0;
    white-space: pre-line;
}
