/* ============================================================
   Sistema de Gestión de Tickets TI
   Desarrollado por: Miguel Angel Salinas Salazar
   Proyecto de Titulación

   Archivo: global.css
   Descripción:
   Estilos generales reutilizados por todas las vistas del sistema.
   Contiene variables, configuración base, layout principal,
   barra superior, menú lateral, tablas, badges y footer.
============================================================ */

/* =========================
   VARIABLES GLOBALES
   Colores principales del sistema
========================= */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-soft: #eef1f5;
    --line: #dde2e8;
    --text: #242a33;
    --muted: #596374;
    --muted-2: #7a8494;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --icon: #4b5563;
    --shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

/* =========================
   CONFIGURACIÓN GENERAL
========================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    overflow-x: hidden;
}

/* =========================
   ICONOS SVG
========================= */
svg {
    width: 1em;
    height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

/* =========================
   ENLACES Y FORMULARIOS BASE
========================= */
a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* =========================
   LAYOUT GENERAL DEL SISTEMA
========================= */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* =========================
   PANEL SUPERIOR / BARRA SUPERIOR
========================= */
.topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 26px;
    background: #1f2937;
    border-bottom: 1px solid #111827;
}

/* Texto e iconos visibles dentro del panel superior */
.topbar,
.topbar a,
.topbar .brand strong,
.topbar .brand small,
.topbar .topnav {
    color: #ffffff;
}

.topbar svg,
.topbar .brand-icon {
    color: #e5e7eb;
}

/* =========================
   MARCA / NOMBRE DEL SISTEMA
========================= */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 230px;
}

.brand-icon {
    width: 34px;
    height: 34px;
    color: #111827;
}

.brand strong {
    display: block;
    font-size: 18px;
    line-height: 1.1;
}

.brand small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

/* =========================
   MENÚ SUPERIOR
========================= */
.topnav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    color: #374151;
    font-size: 14px;
    white-space: nowrap;
}

/* =========================
   LINKS DE NAVEGACIÓN Y ACCIONES
========================= */
.topnav-link,
.side-link,
.quick-actions a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.topnav-link svg {
    width: 16px;
    height: 16px;
}

/* =========================
   CONTENEDOR PRINCIPAL: SIDEBAR + CONTENIDO
========================= */
.workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    min-height: 0;
}

/* =========================
   MENÚ LATERAL
========================= */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 14px 12px;
}

.side-menu {
    display: grid;
    gap: 7px;
}

.side-link {
    min-height: 36px;
    padding: 8px 8px;
    border-radius: 6px;
    color: #374151;
    font-size: 15px;
    transition: background-color 160ms ease, color 160ms ease;
}

.side-link svg {
    width: 16px;
    height: 16px;
}

.side-link:hover,
.side-link.active {
    background: #e5e7eb;
    color: #171717;
}

/* =========================
   CONTENIDO PRINCIPAL
========================= */
.main-content {
    width: 100%;
    min-width: 0;
    padding: 18px 22px 24px;
}

/* =========================
   ALERTAS GENERALES
========================= */
.panel-alert {
    margin: 14px 0 0;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
    background: #fef2f2;
    font-size: 13px;
}

/* =========================
   TABLAS GENERALES
========================= */
table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

th {
    color: var(--muted-2);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

td {
    color: #111827;
    font-size: 14px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

/* =========================
   ESTADO VACÍO DE TABLAS
========================= */
.empty-state {
    height: 80px;
    color: var(--muted);
    text-align: center;
}

/* =========================
   ETIQUETAS / BADGES
========================= */
.badge {
    min-width: 78px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 6px;
    color: #2b2f36;
    background: #e5e7eb;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

/* Estados de ticket */
.estado-abierto {
    background: #dbeafe;
}

.estado-en-proceso {
    background: #fef3c7;
}

.estado-cerrado {
    background: #dcfce7;
}

/* Estados de usuario */
.estado-activo {
    background: #dcfce7;
    color: #166534;
}

.estado-inactivo {
    background: #fee2e2;
    color: #991b1b;
}

/* Prioridades de ticket */
.prioridad-alta {
    background: #fee2e2;
}

.prioridad-media {
    background: #ffedd5;
}

.prioridad-baja {
    background: #dbeafe;
}

/* =========================
   BOTONES CON ICONOS
========================= */
.icon-button {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    color: var(--icon);
    background: transparent;
    cursor: pointer;
}

.icon-button:hover {
    background: var(--surface-soft);
}

.icon-button svg {
    width: 17px;
    height: 17px;
}

/* =========================
   PIE DE PÁGINA
========================= */
.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 16px;
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 13px;
}
/* =========================
   CONTENEDOR GENERAL DE VISTAS INTERNAS
   Usado en páginas como usuarios, historial,
   detalle de ticket, edición y otras vistas del sistema.
========================= */
.ticket-detail-page {
    width: 100%;
    min-height: 100vh;
    padding: 34px 40px;
    background: var(--bg);
}

.ticket-detail-container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 32px;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.ticket-detail-title {
    margin: 0;
    font-size: 24px;
    color: #111827;
}

.ticket-detail-subtitle {
    margin: 6px 0 22px;
    color: var(--muted);
    font-size: 15px;
}

/* =========================
   BOTONES GENERALES DE VISTAS INTERNAS
========================= */
.ticket-detail-actions {
    margin-top: 22px;
}

.ticket-detail-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 18px;
    border: 0;
    border-radius: 7px;
    background: var(--primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.ticket-detail-back:hover {
    background: var(--primary-dark);
}
/* =========================
   RESPONSIVE: VISTAS INTERNAS
========================= */
@media (max-width: 768px) {
    .ticket-detail-page {
        padding: 22px 14px;
    }

    .ticket-detail-container {
        padding: 22px 16px;
    }
}
/* =========================
   CONTENEDOR GENERAL DE TABLAS
   Usado en historial, estadísticas, panel y otras vistas.
========================= */
.table-wrap {
    width: 100%;
    margin-top: 18px;
    overflow-x: auto;
}

/* =========================
   ESTADO: PENDIENTE USUARIO
   Se usa cuando soporte solicita más información.
========================= */
.estado-pendiente-usuario {
    background: #ede9fe;
    color: #5b21b6;
}

/* =========================
   RESPONSIVE GENERAL DEL SISTEMA
========================= */
@media (max-width: 1180px) {
    .topbar {
        padding: 10px 18px;
    }

    .topnav {
        gap: 12px;
        font-size: 13px;
    }

    .workspace {
        grid-template-columns: 175px minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topnav {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 10px 14px;
        overflow-x: auto;
    }

    .side-menu {
        display: flex;
        gap: 8px;
        min-width: max-content;
    }

    .side-link {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 14px;
    }

    .main-content {
        padding: 18px 14px 24px;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 14px 14px;
    }

    .brand {
        min-width: 0;
    }

    .brand-icon {
        width: 32px;
        height: 32px;
    }

    .brand strong {
        font-size: 17px;
    }

    .topnav {
        font-size: 14px;
    }

    th,
    td {
        padding: 10px 12px;
    }

    .footer {
        min-height: 44px;
    }
}