/* ═══════════════════════════════════════════════════════
   CeibeSAT — Estilos personalizados
   ═══════════════════════════════════════════════════════ */

:root {
    --sat-primary: #f97316;
    --sat-primary-dark: #ea580c;
    --sat-bg: #fafaf9;
    --sat-normal: #10b981;
    --sat-urgente: #f59e0b;
    --sat-critica: #ef4444;
    --sat-pendiente: #94a3b8;
    --sat-aprobada: #3b82f6;
    --sat-completada: #10b981;
    --sat-rechazada: #ef4444;
    --sat-dark: #1e293b;
    --sat-gray: #64748b;
    --sat-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
    --sat-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --sat-transition: all 0.2s ease;
}

/* ── GLOBAL ─────────────────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }
body { -webkit-font-smoothing: antialiased; }

/* ── BOTONES GRANDES ────────────────────────────────── */
.btn-sat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 56px;
    padding: 0.875rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: var(--sat-transition);
    text-decoration: none;
    line-height: 1.2;
    -webkit-user-select: none;
    user-select: none;
}
.btn-sat:active { transform: scale(0.97); }

.btn-sat-primary {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}
.btn-sat-primary:hover {
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
    transform: translateY(-1px);
}

.btn-sat-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.btn-sat-success:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-sat-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.btn-sat-danger:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-sat-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 2px solid #e2e8f0;
}
.btn-sat-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.btn-sat-sm {
    min-height: 40px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 12px;
    gap: 0.5rem;
}

/* ── TARJETAS ───────────────────────────────────────── */
.card-sat {
    background: white;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--sat-shadow);
    overflow: hidden;
    transition: var(--sat-transition);
}
.card-sat:hover {
    box-shadow: var(--sat-shadow-lg);
}

/* ── PRIORIDAD BADGES ───────────────────────────────── */
.badge-normal {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.badge-urgente {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.badge-critica {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    animation: pulse-badge 2s infinite;
}

.badge-estado-pendiente {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.badge-estado-aprobada {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.badge-estado-completada {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.badge-estado-rechazada {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── ACORDEONES ─────────────────────────────────────── */
.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    cursor: pointer;
    border-radius: 12px;
    transition: var(--sat-transition);
    -webkit-user-select: none;
    user-select: none;
}
.accordion-header:active { background: #f8fafc; }

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.accordion-content.open {
    max-height: 5000px;
}

/* ── INPUTS ─────────────────────────────────────────── */
.input-sat {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: var(--sat-dark);
    transition: var(--sat-transition);
    -webkit-appearance: none;
}
.input-sat:focus {
    outline: none;
    border-color: var(--sat-primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}
.input-sat::placeholder { color: #94a3b8; }

textarea.input-sat { min-height: 100px; resize: vertical; }

select.input-sat {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 12L2 6h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* ── SWEETALERT2 OVERRIDES ──────────────────────────── */
.swal2-popup.ceibe-alert {
    border-radius: 16px !important;
    border: 2px solid transparent !important;
    background-image: linear-gradient(white, white), linear-gradient(135deg, #f97316, #ea580c) !important;
    background-origin: padding-box, border-box !important;
    background-clip: padding-box, border-box !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 10px 15px -3px rgba(0,0,0,0.15), 0 20px 25px -5px rgba(0,0,0,0.1) !important;
}
/* Variante PELIGRO: borde rojo (acciones irreversibles) */
.swal2-popup.ceibe-alert.ceibe-alert-danger {
    background-image: linear-gradient(white, white), linear-gradient(135deg, #dc2626, #ef4444) !important;
}
.swal2-popup.ceibe-alert.swal2-show { animation: none !important; }
.swal2-popup.ceibe-alert.swal2-hide { animation: none !important; }

/* Toasts */
body.swal2-toast-shown .swal2-container:has(.ceibe-toast-vertical) { width: auto !important; max-width: 720px !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical {
    display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: flex-start !important;
    gap: 0.75rem !important; padding: 0.5rem 1.5rem !important;
    min-width: 300px !important; max-width: 700px !important; width: max-content !important;
    position: relative !important; border-radius: 10px !important;
    border: 1px solid #e2e8f0 !important; background: #f8fafc !important;
    box-shadow: 0 2px 8px -2px rgba(0,0,0,0.08), 0 4px 12px -4px rgba(0,0,0,0.05) !important;
    overflow: hidden !important;
}
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon {
    order: 1 !important; margin: 0 !important; transform: scale(0.6) !important;
    flex-shrink: 0 !important; width: 1.5rem !important; height: 1.5rem !important;
}
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-title { order: 2 !important; margin: 0 !important; padding: 0 !important; justify-content: flex-start !important; flex-shrink: 0 !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-html-container { order: 3 !important; color: #334155 !important; margin: 0 !important; padding: 0 !important; text-align: left !important; flex: 1 !important; min-width: 0 !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-success { border-color: #10b981 !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-success [class^='swal2-success-line'] { background-color: #10b981 !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(16,185,129,0.3) !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-error { border-color: #ef4444 !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-error .swal2-x-mark-line-left,
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-error .swal2-x-mark-line-right { background-color: #ef4444 !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-warning { border-color: #f59e0b !important; color: #f59e0b !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-info { border-color: #3b82f6 !important; color: #3b82f6 !important; }
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-title.ceibe-toast-title,
.ceibe-toast-title {
    color: #1e293b !important; font-weight: 700 !important; font-size: 0.8125rem !important;
    text-align: left !important; line-height: 1.3 !important; text-shadow: none !important;
    white-space: nowrap !important; margin: 0 !important; padding: 0 !important;
}
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-timer-progress-bar-container {
    position: absolute !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
    height: 3px !important; border-radius: 0 0 10px 10px !important; overflow: hidden !important;
}
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-timer-progress-bar {
    height: 3px !important; background: linear-gradient(90deg, #f97316, #ea580c) !important;
}

/* Animaciones Flip */
@keyframes toastFlipIn { 0% { transform: perspective(400px) rotateX(90deg); opacity: 0; } 40% { transform: perspective(400px) rotateX(-10deg); } 70% { transform: perspective(400px) rotateX(10deg); } 100% { transform: perspective(400px) rotateX(0deg); opacity: 1; } }
@keyframes toastFlipOut { 0% { transform: perspective(400px) rotateX(0deg); opacity: 1; } 30% { transform: perspective(400px) rotateX(-10deg); } 100% { transform: perspective(400px) rotateX(90deg); opacity: 0; } }
.toast-flip-in { animation: toastFlipIn 0.5s ease-out forwards; }
.toast-flip-out { animation: toastFlipOut 0.4s ease-in forwards; }

/* Alertas: FADE suave (identico a CeibeRRHH) */
@keyframes alertFlipIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes alertFlipOut { from { opacity: 1; } to { opacity: 0; } }
.alert-flip-in  { animation: alertFlipIn 0.5s ease-out forwards !important; }
.alert-flip-out { animation: alertFlipOut 0.2s ease-in forwards !important; }

/* Fade reutilizable + fade de modales HTML */
@keyframes alertFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes alertFadeOut { from { opacity: 1; } to { opacity: 0; } }
.alert-fade-in  { animation: alertFadeIn 0.5s ease-out forwards !important; }
.alert-fade-out { animation: alertFadeOut 0.2s ease-in forwards !important; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.animate-modal-fade-in { animation: modalFadeIn 0.5s ease-out forwards; }

/* Backdrop sincronizado con la velocidad del popup + swal sobre modales */
.swal2-backdrop-show { animation-duration: 0.5s !important; }
.swal2-backdrop-hide { animation-duration: 0.2s !important; }
.swal-over-modal { z-index: 99999 !important; }

/* Loader (limpio, fade; acento naranja) */
.swal2-popup.ceibe-loader {
    border: 2px solid #f97316 !important; border-radius: 16px !important;
    padding: 2rem 1.5rem !important; box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important; background: white !important;
}
.swal2-popup.ceibe-loader .swal2-title { color: #1f2937 !important; font-size: 1.1rem !important; font-weight: 600 !important; margin-bottom: 1rem !important; }
.swal2-popup.ceibe-loader .swal2-icon { display: none !important; }
.swal2-popup.ceibe-loader.swal2-show { animation: loaderFadeIn 0.2s ease-out !important; }
.swal2-popup.ceibe-loader.swal2-hide { animation: loaderFadeOut 0.15s ease-in !important; }
@keyframes loaderFadeIn  { 0% { opacity: 0; transform: scale(0.95); } 100% { opacity: 1; transform: scale(1); } }
@keyframes loaderFadeOut { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.95); } }

/* ── VISTA SELECCION ────────────────────────────────── */
.view-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.75rem;
    min-height: 72px;
    flex: 1;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    background: white;
    color: var(--sat-gray);
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: var(--sat-transition);
    -webkit-user-select: none;
    user-select: none;
}
.view-tab i { font-size: 1.25rem; }
.view-tab.active {
    border-color: var(--sat-primary);
    background: #fff7ed;
    color: var(--sat-primary);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
}
.view-tab:not(.active):active { background: #f8fafc; }

/* ── MEDIA PREVIEW ──────────────────────────────────── */
.media-thumb {
    width: 64px; height: 64px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: var(--sat-transition);
}
.media-thumb:hover {
    border-color: var(--sat-primary);
    transform: scale(1.05);
}

/* ── GRABACION AUDIO ────────────────────────────────── */
.btn-record {
    width: 64px; height: 64px;
    border-radius: 50%;
    border: 3px solid #ef4444;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--sat-transition);
}
.btn-record.recording {
    background: #ef4444;
    animation: pulse-record 1.5s infinite;
}
.btn-record.recording i { color: white; }

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

/* ── PHOTO EDITOR ───────────────────────────────────── */
.photo-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #000;
    display: flex;
    flex-direction: column;
}
.photo-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem;
    background: #1e293b;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}
.photo-editor-toolbar button {
    min-width: 40px; height: 40px;
    border-radius: 10px;
    border: none;
    background: #334155;
    color: white;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex-shrink: 0;
    transition: var(--sat-transition);
    padding: 0 0.5rem;
}
.photo-editor-toolbar button.active { background: var(--sat-primary); }
.photo-editor-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

/* ── TABS GLASSMORPHISM ────────────────────────────── */
.glass-tabs {
    display: flex;
    position: relative;
    padding: 4px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.glass-tab {
    flex: 1;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.625rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sat-gray);
    border-radius: 12px;
    cursor: pointer;
    transition: color 0.25s ease;
    -webkit-user-select: none;
    user-select: none;
    background: transparent;
    border: none;
}
.glass-tab i { font-size: 0.875rem; }

.glass-tab.active { color: white; }

.glass-tab .glass-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.08);
    color: var(--sat-gray);
    transition: all 0.25s ease;
}
.glass-tab.active .glass-tab-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.glass-tabs-slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    border-radius: 12px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 0;
}
.glass-tabs-slider[data-tab="pendientes"] {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.glass-tabs-slider[data-tab="solucionados"] {
    background: linear-gradient(135deg, #10b981, #059669);
}
.glass-tabs-slider[data-tab="anulados"] {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}
.glass-tabs-slider[data-tab="icon"] {
    background: linear-gradient(135deg, #f97316, #ea580c);
}
.glass-tabs-slider[data-tab="image"] {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.glass-tabs-slider[data-tab="local"] {
    background: linear-gradient(135deg, #f97316, #ea580c);
}
.glass-tabs-slider[data-tab="dia"] {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.glass-tabs-slider[data-tab="trabajador"] {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
/* Admin (prefijo adm- para no colisionar con los estados del encargado) */
.glass-tabs-slider[data-tab="adm-encola"] {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.glass-tabs-slider[data-tab="adm-pendientes"] {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.glass-tabs-slider[data-tab="adm-completadas"] {
    background: linear-gradient(135deg, #10b981, #059669);
}
.glass-tabs-slider[data-tab="adm-rechazadas"] {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* ── NAVBAR LIQUID GLASS (naranja palido) ──────────── */
.navbar-glass {
    background: linear-gradient(180deg, rgba(255, 237, 213, 0.85), rgba(254, 215, 170, 0.72));
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

/* Variante de glass-tabs DEFINIDA sobre el navbar claro */
.glass-tabs.glass-tabs-solid {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(249, 115, 22, 0.30);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(249, 115, 22, 0.10);
}

/* ── PULSO URGENTE (tareas criticas) ───────────────── */
@keyframes sat-pulse-urgent {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.sat-pulse-urgent {
    animation: sat-pulse-urgent 1.2s ease-in-out infinite;
}

/* ── SWAL ENCIMA DE MODALES ─────────────────────────── */
.swal2-container { z-index: 99999 !important; }

/* ── SCROLLBAR SUTIL ────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ── PWA: safe area ─────────────────────────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
    header { padding-top: env(safe-area-inset-top); }
    footer { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── SKELETON LOADING ───────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Estado vacio: resplandor victoria */
@keyframes victory-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.25); }
    50% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}
.empty-state-victory {
    animation: victory-glow 3s ease-in-out infinite;
}
