/* --- Reset Básico --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
}

/* --- ÁREA FLEX PRINCIPAL (MÁRGENES) --- */
.content-area {
    padding: 40px 30px; /* Esto separa el contenido del menú y de los bordes */
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

/* --- Estructura Principal del Dashboard --- */
.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- MENÚ LATERAL (SIDEBAR) --- */
.sidebar {
    width: 260px;
    background-color: #1e293b;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #334155;
    background-color: #ffffff;
}

.sidebar-logo {
    max-width: 140px;
    height: auto;
}

.sidebar-nav {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.nav-title {
    color: #94a3b8;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 0 20px;
    margin-bottom: 10px;
}

.nav-item {
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 20px;
    font-size: 15px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background-color: #334155;
    color: white;
}

.nav-item.active {
    background-color: #334155;
    color: #38bdf8;
    border-left: 4px solid #38bdf8;
    font-weight: bold;
}

/* --- CONTENIDO PRINCIPAL --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* --- Barra Superior --- */
.top-bar {
    background-color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.page-title h2 {
    margin: 0;
    font-size: 20px;
    color: #334155;
}

.user-info {
    font-size: 14px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 20px;
    font-weight: bold;
}

.btn-logout {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-logout:hover {
    background-color: #dc2626;
}

/* --- ENVOLTORIO DEL DASHBOARD --- */
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    gap: 40px;
    width: 100%;
}

/* ==========================
   LAYOUT CREAR TICKET
========================== */
.ticket-creation-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    width: 100%;
}

/* ==========================
   PANEL IZQUIERDO (FORMULARIO)
========================== */
.form-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .05);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.panel-icon-bg {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px; /* Tamaño del icono de la cabecera */
}

.blue-bg {
    background: #eff6ff;
    color: #3b82f6;
}

.panel-header-text h3 {
    margin: 0 0 5px;
    color: #1e293b;
    font-size: 20px;
    font-weight: 700;
}

.panel-header-text p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.panel-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 25px 0;
}

/* Filas del Formulario */
.form-row {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.row-label {
    flex: 0 0 35%;
    display: flex;
    gap: 15px;
}

.field-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px; /* Tamaño de los iconos de los campos */
    flex-shrink: 0;
}
.field-icon i{
    font-size:21px;
}

.blue-text i { color: #3b82f6; font-size: 18px; }
.red-text i { color: #ef4444; font-size: 18px; }
.green-text i { color: #10b981; font-size: 18px; }
.blue-light{
    background:#eef6ff;
    color:#2563eb;
}

.purple-light{
    background:#f5edff;
    color:#8b5cf6;
}

.green-light{
    background:#ebfff2;
    color:#22c55e;
}

.orange-light{
    background:#fff4e8;
    color:#f97316;
}

.field-text label {
    display: block;
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.field-text label span {
    color: #ef4444;
}

.field-text label span.opcional {
    color: #94a3b8;
    font-weight: 500;
    font-size: 12px;
    margin-left: 5px;
}

.field-text p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

/* Inputs y Áreas de Texto */
.row-input {
    flex: 1;
    position: relative;
}

.row-input input,
.row-input select,
.row-input textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    transition: all 0.3s;
    box-sizing: border-box;
    /* Asegura que el padding no rompa el ancho */
}

.row-input input:focus,
.row-input select:focus,
.row-input textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.row-input textarea {
    height: 120px;
    resize: vertical;
}

.char-counter {
    position: absolute;
    bottom: -20px;
    right: 0;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}

/* Dropzone Evidencia */
.file-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.3s;
}

.file-drop-zone:hover {
    border-color: #0284c7;
    background: #f0f9ff;
}

.file-drop-zone p {
    margin: 10px 0 5px;
    font-size: 14px;
    color: #475569;
}

.file-drop-zone p span {
    color: #0284c7;
    font-weight: 700;
}

.file-drop-zone small {
    color: #94a3b8;
    font-size: 12px;
}

/* Botón y Footer */
.form-actions {
    margin-top: 40px;
    text-align: center;
}

.btn-submit {
    background: #0284c7;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 0;
    width: 100%;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.3s;
}

.btn-submit:hover {
    background: #0369a1;
}

.form-footer {
    margin-top: 15px;
    color: #64748b;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ==========================
   PANEL DERECHO (TARJETAS INFO)
========================== */
.info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .05);
}

/* Bordes laterales de color (Diseño moderno) */
.border-blue {
    border-left: 4px solid #3b82f6;
}

.border-red {
    border-left: 4px solid #ef4444;
}

.border-green {
    border-left: 4px solid #10b981;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.card-title h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.blue-text h4 {
    color: #1e293b;
}

.info-card p {
    margin: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.sla-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sla-list li {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #475569;
}

.sla-list strong {
    color: #1e293b;
    margin-right: 5px;
}

.sla-list .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

/* MENSAJES DE ÉXITO/ERROR (De tu código original, adaptados) */
.message-box {
    font-size: 14px;
    text-align: center;
    margin-top: 20px;
    display: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
}

.success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ==========================
   FILA SUPERIOR DEL DASHBOARD
========================== */
.dashboard-top {
    display: grid;
    /* Ajuste de fracciones: 1.7 (Tarjetas) | 1.6 (Gráfico) | 1 (Último Ticket) */
    grid-template-columns: 1.7fr 1.6fr 1fr;
    gap: 20px;
    align-items: stretch;
    width: 100%;
}

/* ==========================
   TARJETAS DE ESTADÍSTICAS
========================== */

.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    height: 100%;
}



.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;

    display: flex;
    flex-direction: column;
    align-items: flex-start;

    gap: 14px;



    box-shadow: 0 4px 10px rgba(0, 0, 0, .05);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .08);
}

/* ==========================
   ICONOS
========================== */

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
}

.icon-box i {
    font-size: 22px;
}

/* Fondos */

.red {
    background: #fee2e2;
}

.amber {
    background: #fef3c7;
}

.green {
    background: #d1fae5;
}

/* Colores */

.red i {
    color: #ef4444;
}

.amber i {
    color: #f59e0b;
}

.green i {
    color: #10b981;
}

/* ==========================
   TEXTO
========================== */

.info {
    width: 100%;
}

.info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #64748b;
}

.info p {
    margin: 8px 0 4px;
    font-size: 40px;
    font-weight: 700;
}

.info small {
    font-size: 18px;
    font-weight: 600;
}

#pctAbiertos {
    color: #ef4444;
}

#pctProceso {
    color: #f59e0b;
}

#pctResueltos {
    color: #10b981;
}


/* ==========================
   TARJETA DEL GRÁFICO (ACTUALIZADA)
========================== */
.card-chart {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .05);
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* ELIMINAMOS LA LÍNEA width: 100% y max-width */
}

/* Cabecera (Título y Filtro) */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    /* Separación de seguridad entre título y filtro */
    width: 100%;
}

.chart-header h4 {
    margin: 0 !important;
    width: auto !important;
    /* Anula el 100% que estaba causando el cruce */
    text-align: left !important;
    color: #1f2937;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    /* Evita que el título se divida en dos líneas */
}

.filter-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    color: #64748b;
    background: #fff;
    flex-shrink: 0;
    /* Obliga al filtro a mantener su tamaño y no dejarse aplastar */
}

.filter-box select {
    border: none;
    outline: none;
    color: #475569;
    font-weight: 600;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
}

/* Cuerpo (Dona a la izquierda, Leyenda a la derecha) */
.chart-body {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centramos todo el bloque */
    gap: 50px;
    /* Separación amplia pero controlada entre dona y leyenda */
}

.chart-canvas-wrapper {
    width: 150px;
    /* Ligeramente más compacto */
    height: 150px;
    flex-shrink: 0;
    position: relative;
}

.chart-legend-custom {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #edf2f7;
}

.legend-item:last-child {
    border-bottom: none;
    /* Quitamos la línea al último elemento */
}

.legend-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-value {
    font-weight: 700;
    color: #1e293b;
    display: flex;
    gap: 5px;
}

.legend-pct {
    font-weight: 600;
    font-size: 12px;
}


/* ==========================
   CONTENIDO DE ÚLTIMA INCIDENCIA
========================== */
.card-last {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .05);

    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
    /* ELIMINAMOS LA LÍNEA width: 100% */
}

.last-ticket-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Icono principal de la tarjeta */
.last-ticket-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 5px;
}

/* Título de la incidencia */
.last-ticket-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* Etiqueta de estado (Badge) */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: max-content;
}

.status-abierto {
    background: #fee2e2;
    color: #ef4444;
}

.status-proceso {
    background: #fef3c7;
    color: #f59e0b;
}

.status-resuelto {
    background: #d1fae5;
    color: #10b981;
}

/* Detalles de fecha y usuario */
.last-ticket-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.detail-item i {
    font-size: 14px;
    color: #94a3b8;
}

/* ==========================
   TICKETS RECIENTES (TABLA)
========================== */
.recent-section {
    margin-top: 40px;
    width: 100%;
}

.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.recent-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 16px;
    font-weight: 700;
}

.btn-view-all {
    background: #1e293b;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-view-all:hover {
    background: #334155;
}

.recent-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .05);
    overflow: hidden;
    /* Para que la tabla no se salga de los bordes redondeados */
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
}

.tickets-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    text-align: left;
    padding: 14px 20px;
    letter-spacing: 0.5px;
}

.tickets-table td {
    padding: 16px 20px;
    font-size: 13px;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 500;
    vertical-align: middle;
}

.tickets-table tr:hover {
    background: #f8fafc;
}

/* Puntitos dinámicos de prioridad */
.priority-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

/* Colores según el nivel */
.priority-alta {
    background: #ef4444;
}

/* Rojo */
.priority-media {
    background: #f59e0b;
}

/* Naranja/Ámbar */
.priority-baja {
    background: #10b981;
}

/* Verde */

/* ==========================
   CALL TO ACTION (REPORTAR)
========================== */
.cta-reportar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.cta-icon-wrapper {
    width: 50px;
    height: 50px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #64748b;
    margin-bottom: 15px;
}

.cta-reportar h4 {
    margin: 0 0 5px;
    color: #1e293b;
    font-size: 15px;
}

.cta-reportar p {
    margin: 0 0 20px;
    color: #64748b;
    font-size: 13px;
}

.btn-new-ticket {
    background: #1e293b;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

/* ==========================
   ENVOLTORIO DEL DASHBOARD
========================== */
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    gap: 40px;
    /* Separación perfecta entre la parte superior y la tabla */
    width: 100%;
}

/* ==========================
   LAYOUT CREAR TICKET
========================== */
.ticket-creation-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    width: 100%;
}