/* e:/Incidencias/assets/css/style.css */

/* --- SISTEMA DE DISEÑO --- */
:root {
    /* Colores Principales (Indigo/Violeta Premium) */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.15);
    
    --success: #10b981;
    --success-hover: #059669;
    --success-glow: rgba(16, 185, 129, 0.1);
    
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.1);
    
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.1);
    
    --info: #3b82f6;
    --info-glow: rgba(59, 130, 246, 0.1);
    
    --purple: #8b5cf6;
    --purple-glow: rgba(139, 92, 246, 0.1);

    /* Grises Neutros (Esquema Oscuro por defecto / Ultra Moderno) */
    --bg-main: #f0f2f5;
    --bg-card: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.2);
    
    --text-main: #09090b;
    --text-muted: #475569;
    --text-inverse: #ffffff;
    
    --glass-blur: blur(12px);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- ESTILOS GENERALES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* --- GLASSMORPHISM CARD --- */
.glass {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), 0 0 20px var(--primary-glow);
    border-color: var(--border-hover);
}

/* --- MÁQUETACIÓN LOGIN & REGISTRO --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 480px;
    margin: 40px auto;
}

.login-card {
    padding: 40px 30px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #1f2937, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px 16px 12px 42px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 15px;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 12px var(--primary-glow);
}

select {
    cursor: pointer;
    appearance: none;
    color-scheme: light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

select option {
    background-color: #ffffff;
    color: #1f2937;
    padding: 8px 12px;
    font-size: 14px;
}

select option:hover,
select option:focus,
select option:checked {
    background-color: #6366f1;
    color: #ffffff;
}

select optgroup {
    background-color: #ffffff;
    color: #1f2937;
}

textarea {
    padding-left: 16px; /* Sin icono */
    resize: vertical;
    min-height: 100px;
}

/* --- BOTONES PREMIUM --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, var(--primary-hover), var(--purple));
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-hover));
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--border-hover);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* --- HEADER GLASSMORPHIC --- */
.main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-item {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.08);
}

.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
    border-left: 1px solid var(--border-color);
}

.avatar-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.user-info-text {
    font-size: 13px;
}

.user-name {
    font-weight: 600;
    display: block;
}

.user-role {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- ESTRUCTURA DE PÁGINAS --- */
.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 30px;
    flex-grow: 1;
}

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

.page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* --- DASHBOARD: TARJETAS DE MÉTRICAS --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.metric-card.success::after { background: var(--success); }
.metric-card.warning::after { background: var(--warning); }
.metric-card.danger::after { background: var(--danger); }
.metric-card.info::after { background: var(--info); }
.metric-card.purple::after { background: var(--purple); }

.metric-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 36px;
    font-weight: 700;
    margin-top: 6px;
}

.metric-icon-bg {
    font-size: 40px;
    opacity: 0.2;
}

/* --- DASHBOARD: SECCIÓN DE GRÁFICOS Y TABLAS --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-card {
    padding: 24px;
    min-height: 400px;
}

.dashboard-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- LISTAS, TABLAS Y FILTROS --- */
.filter-card {
    padding: 20px;
    margin-bottom: 30px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* --- BADGES (ETIQUETAS DE ESTADO/PRIORIDAD) --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Badges Estado */
.badge-abierto { background: var(--danger-glow); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-asignado { background: var(--info-glow); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-proceso { background: var(--warning-glow); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-terminado { background: var(--success-glow); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-pendiente { background: var(--warning-glow); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-espera { background: var(--purple-glow); color: var(--purple); border: 1px solid rgba(139, 92, 246, 0.2); }
.badge-cancelado { background: rgba(156, 163, 175, 0.1); color: var(--text-muted); border: 1px solid rgba(156, 163, 175, 0.2); }

/* Badges Prioridad */
.badge-prioridad-baja { background: var(--success-glow); color: var(--success); }
.badge-prioridad-media { background: var(--info-glow); color: var(--info); }
.badge-prioridad-alta { background: var(--warning-glow); color: var(--warning); }
.badge-prioridad-urgente { background: var(--danger-glow); color: var(--danger); font-weight: 700; border: 1px dashed var(--danger); }

/* --- INCIDENCIAS GRID CARD (VISTA MOVIL) --- */
.incidencias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.incidencia-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.incidencia-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.incidencia-code {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
}

.incidencia-card-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.incidencia-meta-item {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- VISTA DETALLE & HISTORIAL --- */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-section {
    padding: 24px;
    margin-bottom: 30px;
}

.detail-title {
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-info-row {
    display: flex;
    margin-bottom: 15px;
    font-size: 14px;
}

.detail-info-label {
    width: 30%;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-info-value {
    width: 70%;
}

/* LÍNEA DE TIEMPO (TIMELINE) */
.timeline {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
    margin-left: 10px;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-main);
}

.timeline-date {
    font-size: 11px;
    color: var(--text-muted);
}

.timeline-title {
    font-size: 13px;
    font-weight: 600;
    margin: 2px 0;
}

.timeline-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* --- SECCIÓN COMENTARIOS --- */
.comment-box {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
}

.comment-date {
    font-size: 11px;
    color: var(--text-muted);
}

.comment-text {
    font-size: 13px;
    margin-top: 4px;
}

/* --- CALENDARIO PREMIUM --- */
.calendar-layout {
    display: grid;
    grid-template-columns: 1fr 290px;
    gap: 20px;
    align-items: flex-start;
}

.calendar-container {
    padding: 20px;
    min-width: 0;
}

/* --- BANDEJA DE PARTES NO ASIGNADOS --- */
.unassigned-panel {
    position: sticky;
    top: 80px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.unassigned-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.unassigned-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.unassigned-count-badge {
    background: rgba(99,102,241,0.2);
    color: var(--primary);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 700;
}

.unassigned-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    padding-right: 4px;
}

.unassigned-list::-webkit-scrollbar {
    width: 4px;
}
.unassigned-list::-webkit-scrollbar-track { background: transparent; }
.unassigned-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.unassigned-card {
    background: rgba(99,102,241,0.06);
    border: 1px solid rgba(99,102,241,0.2);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: grab;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-main);
    display: block;
    user-select: none;
}

.unassigned-card:hover {
    background: rgba(99,102,241,0.12);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.2);
}

.unassigned-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(0.97);
}

.unassigned-card-code {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 3px;
}

.unassigned-card-client {
    font-size: 11px;
    color: var(--text-main);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.unassigned-card-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.unassigned-empty {
    text-align: center;
    padding: 20px 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.unassigned-drag-hint {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 6px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* Estado cuando se arrastra un parte SOBRE el panel para quitarle la fecha */
.unassigned-panel.drag-over-unassign {
    border-color: var(--danger, #ef4444);
    background: rgba(239, 68, 68, 0.08);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.unassigned-panel.drag-over-unassign .unassigned-drag-hint {
    border-color: var(--danger, #ef4444);
    color: #ef4444;
    content: '🗑️ Suelta aquí para quitar fecha';
}

.unassigned-panel.drag-over-unassign::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    border: 2px dashed #ef4444;
    pointer-events: none;
    animation: pulse-border 0.8s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Posición relativa para el pseudo-elemento */
.unassigned-panel {
    position: sticky;
    top: 80px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 1100px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }
    .unassigned-panel {
        position: static;
        max-height: 220px;
        order: -1;
    }
    .unassigned-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .unassigned-card {
        min-width: 160px;
    }
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.calendar-day-name {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    padding: 10px 0;
}

.calendar-day {
    min-height: 100px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.calendar-day.empty {
    background: transparent;
    border: none;
}

.calendar-day.today {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.calendar-day-number {
    font-weight: 600;
    font-size: 14px;
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.calendar-event {
    font-size: 11px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* --- CAPTURA DE FIRMAS TÁCTIL --- */
.signature-container {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.signature-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-main);
}

.signature-canvas {
    background: #ffffff;
    border-radius: var(--radius-sm);
    cursor: crosshair;
    display: block;
    margin: 0 auto;
    max-width: 100%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.signature-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

/* --- ALERTAS Y NOTIFICACIONES FLASH --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    border-left: 4px solid transparent;
}

.alert-danger {
    background: var(--danger-glow);
    color: var(--danger);
    border-left-color: var(--danger);
}

.alert-success {
    background: var(--success-glow);
    color: var(--success);
    border-left-color: var(--success);
}

/* Notificación Flash Emergente */
.flash-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.flash-success { border-left-color: var(--success); background: rgba(16, 185, 129, 0.9); color: white; }
.flash-danger { border-left-color: var(--danger); background: rgba(239, 68, 68, 0.9); color: white; }
.flash-info { border-left-color: var(--info); background: rgba(59, 130, 246, 0.9); color: white; }
.flash-warning { border-left-color: var(--warning); background: rgba(245, 158, 11, 0.9); color: white; }

.flash-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.flash-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

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

/* ZONA DE ARRASTRE DE ARCHIVOS */
.file-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-drop-zone:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.03);
}

.file-drop-icon {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

.file-drop-text {
    font-size: 14px;
    color: var(--text-muted);
}

.file-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.file-preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 80px;
    border: 1px solid var(--border-color);
}

.file-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* UTILIDADES RÁPIDAS */
.text-center { text-align: center; }
.justify-center { justify-content: center; }
.my-4 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0px; }
.color-text-muted { color: var(--text-muted); }
.text-base { font-size: 15px; }
.leading-relaxed { line-height: 1.6; }
.font-bold { font-weight: 700; }
.flex { display: flex; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

.demo-credentials {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 12px;
    margin-top: 20px;
    text-align: left;
}

.demo-credentials p {
    margin-bottom: 4px;
}

.demo-credentials code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: #a5b4fc;
}

/* BOTONES DE ACCION RÁPIDA (TECNICOS) */
.action-card-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
}

.action-card-label {
    font-size: 14px;
    font-weight: 600;
}

.action-card-btn-group {
    display: flex;
    gap: 8px;
}

/* COMPILADOR DE ESTADISTICAS */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
}

/* --- ESTILOS ADICIONALES PARA CALENDARIO INTERACTIVO --- */
.calendar-day {
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.calendar-day:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Drag and Drop Hovers */
.calendar-day.drag-over {
    background-color: rgba(99, 102, 241, 0.15) !important;
    border: 2px dashed var(--primary) !important;
}

.calendar-event.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

/* Partes TERMINADOS en el calendario: texto tachado y apagado, sin perder color */
.calendar-event[data-estado="Terminado"] {
    text-decoration: line-through;
    opacity: 0.6;
}

.calendar-event[data-estado="Terminado"] strong {
    text-decoration: line-through;
}

.calendar-event[data-estado="Terminado"] .cal-status-icon {
    text-decoration: none;
    display: inline-block;
}

/* Icono de estado pequeño junto al código */
.cal-status-icon {
    font-size: 9px;
    vertical-align: middle;
    margin-left: 2px;
    display: inline-block;
    text-decoration: none !important;
    line-height: 1;
}

/* Modales Premium */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    width: 90%;
    max-width: 600px;
    padding: 24px;
    border: 1px solid var(--border-hover);
    box-shadow: var(--shadow-lg);
    animation: scaleUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-body {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.modal-item-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.modal-item-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-hover);
}

.modal-item-info {
    font-size: 13px;
    line-height: 1.5;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- EXPANDED DAY MODAL (CALENDARIO GRANDE) --- */
.expanded-day-modal {
    width: 95%;
    max-width: 800px !important;
    max-height: 90vh;
    padding: 28px;
    display: flex;
    flex-direction: column;
}

.expanded-day-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 8px;
}

.empty-day-view {
    text-align: center;
    padding: 50px 20px;
}

.day-summary-bar {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--primary);
}

.expanded-event-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0;
    margin-bottom: 14px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.expanded-event-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.expanded-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}

.expanded-event-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

.expanded-event-body {
    padding: 14px 18px;
}

.expanded-event-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.expanded-event-row:last-child {
    border-bottom: none;
}

.expanded-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 120px;
}

.expanded-value {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: right;
    display: flex;
    align-items: center;
    gap: 8px;
}

.expanded-event-desc {
    padding: 10px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    margin-top: 4px;
}

.expanded-event-footer {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.01);
    border-top: 1px solid var(--border-color);
}

.copy-phone-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
    transition: all 0.15s ease;
}

.copy-phone-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* --- DRAG & DROP VISUAL HINTS --- */
.drop-target-hint {
    transition: all 0.15s ease;
}

.calendar-event[draggable="true"] {
    cursor: grab;
}

.calendar-event[draggable="true"]:active {
    cursor: grabbing;
}

/* --- DRAG TOAST NOTIFICATION --- */
.drag-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(17, 19, 31, 0.95);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.drag-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- RESPONSIVE CALENDAR EXPANDED --- */
@media (max-width: 768px) {
    .expanded-day-modal {
        width: 100%;
        max-height: 95vh;
        margin: 10px;
        padding: 18px;
    }
    
    .expanded-event-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .expanded-value {
        text-align: left;
    }
    
    .expanded-event-footer {
        flex-direction: column;
    }
    
    .expanded-event-footer .btn {
        width: 100%;
        justify-content: center;
    }
}


/* --- CLASES RESPONSIVAS PARA FIRMA TÁCTIL --- */
.signature-flex {
    display: flex;
    justify-content: space-around;
    gap: 25px;
    flex-wrap: wrap;
}

.signature-block-wrapper {
    flex-grow: 1;
    max-width: 45%;
}

@media (max-width: 768px) {
    .signature-flex {
        flex-direction: column;
        align-items: center;
    }
    
    .signature-block-wrapper {
        max-width: 100%;
        width: 100%;
    }
}

/* --- RESPONSIVIDAD GENERAL (VISTA MÓVIL TÉCNICOS) --- */
@media (max-width: 768px) {
    /* Convertir grids a 1 columna en móviles */
    .filter-grid, 
    .incidencias-grid,
    .detail-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    /* Cabecera general */
    .header-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .user-profile-menu {
        border-left: none;
        padding-left: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }

    /* Cabecera de páginas */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Botones que ocupen todo el ancho en móvil si es necesario */
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Padding de la vista */
    .container {
        padding: 15px;
    }

    /* Tarjetas */
    .glass {
        padding: 15px !important;
    }

    .incidencia-meta-item {
        font-size: 14px;
        flex-direction: column;
        align-items: flex-start;
    }
}

/* --- SEARCHABLE SELECT COMPONENT --- */
.searchable-select-container {
    position: relative;
    width: 100%;
}
.searchable-select-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 15px;
    transition: all 0.2s ease;
}
.searchable-select-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 12px var(--primary-glow);
}
.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}
.searchable-select-dropdown.show {
    display: block;
}
.searchable-select-list {
    list-style: none;
    margin: 0;
    padding: 5px 0;
}
.searchable-select-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
    transition: background 0.15s ease;
}
.searchable-select-item:hover, .searchable-select-item.selected {
    background: var(--primary-glow);
    color: var(--primary-hover);
}
.searchable-select-empty {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}
.searchable-select-add-btn {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--success);
    border-top: 1px dashed var(--border-color);
    background: var(--success-glow);
    font-weight: 500;
}
.searchable-select-add-btn:hover {
    background: rgba(16, 185, 129, 0.15);
}

