/*
 * assets/css/custom.css
 * Estilos personalizados y arquitectura responsiva - Kamila Muebles ERP
 * Paleta Corporativa:
 *   - Azul Petroleo / Teal: #0E8AA8 / #009BB8 (Primario)
 *   - Beige / Arena Calido: #C7BEAA / #BFB29E (Secundario)
 *   - Cafe / Gris Oscuro:   #524A40 (Institucional / Sidebar)
 *   - Fondos Claros:        #F8F7F4 y #FFFFFF
 * Sin emojis en ningun componente.
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
    --color-primary:        #0E8AA8;
    --color-primary-hover:  #0a7291;
    --color-secondary:      #C7BEAA;
    --color-dark:           #524A40;
    --color-dark-hover:     #3e372f;
    --color-light:          #F8F7F4;
    --color-surface:        #FFFFFF;
    --sidebar-width:        260px;
    --header-height:        64px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--color-light);
    color: #2D3748;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================
   ARQUITECTURA DE LAYOUT Y RESPONSIVIDAD (DESKTOP & MOVIL)
   ========================================================== */

#main-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--color-dark);
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

#main-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: var(--header-height);
    background-color: #FFFFFF;
    z-index: 40;
    border-bottom: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

#page-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-left: 0;
    width: 100%;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* EN PANTALLAS MD Y SUPERIORES (DESKTOP): Desplazamiento exacto del Sidebar */
@media (min-width: 768px) {
    #main-sidebar {
        transform: translateX(0) !important;
    }
    #main-header {
        left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
    #page-content {
        margin-left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
}

/* EN PANTALLAS MENORES A 768px (MOVIL): Sidebar oculto por defecto */
@media (max-width: 767px) {
    #main-sidebar.-translate-x-full {
        transform: translateX(-100%) !important;
    }
    #main-sidebar:not(.-translate-x-full) {
        transform: translateX(0) !important;
    }
    #main-header {
        left: 0 !important;
        width: 100% !important;
    }
    #page-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ==========================================================
   ESTILOS VISUALES DEL SIDEBAR Y NAVEGACION
   ========================================================== */

.sidebar-item {
    color: rgba(255, 255, 255, 0.82) !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
    border-radius: 0.5rem;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.09) !important;
    color: #FFFFFF !important;
}

.sidebar-item.active-link,
.sidebar-item.group-active {
    background-color: var(--color-primary) !important;
    color: #FFFFFF !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(14, 138, 168, 0.35) !important;
}

.sidebar-sub-item {
    color: rgba(255, 255, 255, 0.72) !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
}

.sidebar-sub-item:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #FFFFFF !important;
}

.sidebar-sub-item.active-link {
    background-color: rgba(14, 138, 168, 0.35) !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    border-left: 3px solid #38bdf8 !important;
}

/* ==========================================================
   GARANTIA DE PALETA CORPORATIVA (TEAL / BEIGE / DARK)
   ========================================================== */

.bg-teal-50   { background-color: #f0fdfa !important; }
.bg-teal-100  { background-color: #ccfbf1 !important; }
.bg-teal-200  { background-color: #99f6e4 !important; }
.bg-teal-500  { background-color: #14b8a6 !important; }
.bg-teal-600  { background-color: #0E8AA8 !important; }
.bg-teal-700  { background-color: #0a7291 !important; }
.bg-teal-800  { background-color: #115e59 !important; }
.bg-teal-900  { background-color: #134e4a !important; }

.text-teal-600 { color: #0E8AA8 !important; }
.text-teal-700 { color: #0f766e !important; }
.text-teal-800 { color: #115e59 !important; }
.text-teal-900 { color: #134e4a !important; }

.border-teal-200 { border-color: #99f6e4 !important; }
.border-teal-300 { border-color: #5eead4 !important; }
.border-teal-600 { border-color: #0E8AA8 !important; }

.hover\:bg-teal-700:hover { background-color: #0a7291 !important; }

/* ==========================================================
   SCROLLBARS SUTILES Y ELEGANTES
   ========================================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #F1F5F9;
}
::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #0E8AA8;
}

/* ==========================================================
   COMPONENTES VISUALES: CARDS, TABLAS, MODALES
   ========================================================== */

/* Zoom hover suave en imagenes de producto */
.thumb-producto {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}
.thumb-producto:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(14, 138, 168, 0.25);
}

/* Lightbox global de fotografia */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    object-fit: contain;
}

/* Tablas con scroll horizontal suave en moviles */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================
   REGLAS DE IMPRESION (CARTA Y TICKET)
   ========================================================== */

@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    #main-sidebar,
    #main-header,
    #sidebar-overlay,
    .no-print,
    .sidebar-toggle,
    header,
    aside,
    .hidden,
    [hidden] {
        display: none !important;
    }
    #page-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    /* Reglas explicitas de aislamiento por formato */
    body.printing-carta .print-ticket,
    body.printing-carta #print-area-ticket,
    body.printing-carta #area-impresion-ticket {
        display: none !important;
        visibility: hidden !important;
    }

    body.printing-ticket .print-carta,
    body.printing-ticket #print-area-carta,
    body.printing-ticket #area-impresion-carta,
    body.printing-ticket #area-impresion-inventario {
        display: none !important;
        visibility: hidden !important;
    }

    /* Formato Carta Formal */
    .print-carta:not(.hidden) {
        display: block !important;
        width: 100% !important;
        max-width: 8.5in !important;
        margin: 0 auto !important;
        padding: 0.25in !important;
        box-shadow: none !important;
        border: none !important;
        page-break-after: avoid !important;
    }

    /* Formato Ticket Termico (58/80mm) - Tipografia de alta definicion y contraste */
    .print-ticket:not(.hidden), .ticket-termico-kamila {
        display: block !important;
        width: 290px !important;
        max-width: 80mm !important;
        margin: 0 auto !important;
        padding: 2mm 0 !important;
        font-family: 'JetBrains Mono', 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif !important;
        font-size: 13px !important;
        line-height: 1.35 !important;
        color: #000000 !important;
        background: #ffffff !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        text-rendering: optimizeLegibility !important;
        box-shadow: none !important;
        border: none !important;
        page-break-after: avoid !important;
    }

    .ticket-termico-kamila img,
    .print-ticket img {
        width: 175px !important;
        max-width: 185px !important;
        max-height: 60px !important;
        height: auto !important;
        margin: 0 auto 6px auto !important;
        display: block !important;
        object-fit: contain !important;
        filter: grayscale(100%) contrast(300%) brightness(0%) !important;
        -webkit-filter: grayscale(100%) contrast(300%) brightness(0%) !important;
    }
}

/* Reglas de visualizacion en pantalla para tickets termicos */
.ticket-termico-kamila img,
.print-ticket img {
    width: 175px !important;
    max-width: 185px !important;
    max-height: 60px !important;
    height: auto !important;
    margin: 0 auto 6px auto !important;
    display: block !important;
    object-fit: contain !important;
}

/* Realce grafico animado para filas y elementos referenciados por notificaciones */
@keyframes rowHighlightPulse {
    0% {
        background-color: rgba(14, 138, 168, 0.35);
        outline: 2px solid #0E8AA8;
        transform: scale(1.015);
    }
    40% {
        background-color: rgba(14, 138, 168, 0.20);
        outline: 2px solid #0E8AA8;
        transform: scale(1);
    }
    100% {
        background-color: transparent;
        outline: 2px solid transparent;
        transform: scale(1);
    }
}

.highlight-row {
    animation: rowHighlightPulse 3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
    position: relative;
    z-index: 10;
}

/* ==========================================================
   SELECTOR GRAFICO DE BANDERAS Y LADA PARA TELEFONOS
   ========================================================== */
.kamila-phone-field {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.kamila-phone-field .kamila-phone-trigger {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
    cursor: pointer;
}

.kamila-phone-field input {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-left: none !important;
    flex: 1 1 auto;
}

.kamila-phone-field .kamila-phone-dropdown {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 100 !important;
}

.kamila-phone-field .kamila-flag-icon svg {
    display: block;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ==========================================================
   KIT DE ANIMACIONES Y TRANSICIONES UX ESTILO TAILWIND
   ========================================================== */

/* 1. Keyframes de Animacion Suave */
@keyframes uxFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes uxModalPopIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

@keyframes uxSlideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes uxProgressIndeterminate {
    0% {
        left: -35%;
        right: 100%;
    }
    60% {
        left: 100%;
        right: -90%;
    }
    100% {
        left: 100%;
        right: -90%;
    }
}

@keyframes uxProgressSheen {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes uxShimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

@keyframes uxPulseSubtle {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

/* 2. Modales del ERP con apertura fluida tipo macOS / Tailwind UI */
.fixed.inset-0:not(.hidden) {
    animation: uxBackdropFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fixed.inset-0:not(.hidden) > div {
    animation: uxModalPopIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. Microinteracciones de Tarjetas y Elementos Kanban */
.pipeline-card {
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease !important;
}

.pipeline-card:hover {
    transform: translateY(-2.5px) !important;
    box-shadow: 0 10px 18px -4px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03) !important;
    border-color: #0E8AA8 !important;
}

.pipeline-card:active {
    transform: translateY(0px) scale(0.99) !important;
}

/* 4. Botones y Controles con respuesta tactil */
button:not(:disabled), .btn-ux {
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

button:not(:disabled):active, .btn-ux:active {
    transform: scale(0.97) !important;
}

/* 5. Inputs y Selects con transicion de enfoque suave */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(14, 138, 168, 0.18) !important;
    border-color: #0E8AA8 !important;
}

/* 6. Barras de Progreso Elegantes (UX Progressbar) */
.ux-progress-container {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.ux-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0E8AA8 0%, #00B8D9 100%);
    border-radius: 9999px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ux-progress-bar.animated-sheen {
    background: linear-gradient(90deg, #0E8AA8 0%, #38bdf8 50%, #0E8AA8 100%);
    background-size: 200% 100%;
    animation: uxProgressSheen 2s linear infinite;
}

.ux-progress-indeterminate {
    position: relative;
    width: 100%;
    height: 4px;
    background-color: #e0f2fe;
    overflow: hidden;
    border-radius: 9999px;
}

.ux-progress-indeterminate::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    background: linear-gradient(90deg, #0E8AA8, #0284c7);
    border-radius: 9999px;
    animation: uxProgressIndeterminate 1.8s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

/* 7. Skeleton / Shimmer para estados de carga */
.ux-skeleton {
    background: #f1f5f9;
    background-image: linear-gradient(to right, #f1f5f9 0%, #e2e8f0 20%, #f1f5f9 40%, #f1f5f9 100%);
    background-repeat: no-repeat;
    background-size: 800px 104px;
    animation: uxShimmer 1.5s linear infinite forwards;
    border-radius: 0.5rem;
}

/* 8. Transiciones de Vistas y Paneles */
.ux-fade-in {
    animation: uxFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 9. Efecto sutil en tablas */
table tbody tr {
    transition: background-color 0.16s ease;
}

/* 10. Modales con Zoom y Fade Suave */
@keyframes uxModalPop {
    0% {
        opacity: 0;
        transform: scale(0.96) translateY(6px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fixed.inset-0:not(.hidden) > div {
    animation: uxModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 11. Pulso interactivo de estatus y badges */
@keyframes uxStatusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(1.08); }
}

.ux-dot-pulse {
    animation: uxStatusPulse 1.8s ease-in-out infinite;
}

/* 12. Transiciones para cambios de pestana / switchers */
.ux-tab-transition {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 13. Resalte interactivo de tarjeta seleccionada */
.ux-card-selected {
    border-color: #0E8AA8 !important;
    background-color: #f0fdfa !important;
    box-shadow: 0 0 0 2px rgba(14, 138, 168, 0.2) !important;
}
