/* assets/css/custom.css - PrestaSys UI Theme */
:root {
    --primary-color: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary-color: #0f172a;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
}

/* Estado de menú lateral minimizado en desktop */
body.sidebar-collapsed,
html.sidebar-collapsed body {
    --sidebar-width: var(--sidebar-collapsed-width);
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s ease;
    z-index: 1040;
    overflow-x: hidden !important;
}

.app-sidebar nav.sidebar-scroll {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex-wrap: nowrap !important;
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(15, 23, 42, 0.7);
    scroll-behavior: smooth;
}

/* Barra de deslizamiento (Scrollbar) clara, visible y cómoda */
.app-sidebar nav.sidebar-scroll::-webkit-scrollbar {
    width: 8px;
}

.app-sidebar nav.sidebar-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.7);
    border-radius: 8px;
    margin: 4px 0;
}

.app-sidebar nav.sidebar-scroll::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 8px;
    border: 2px solid #0f172a;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
}

.app-sidebar nav.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: #60a5fa;
    cursor: pointer;
}

/* Forzar explícitamente dimensiones del sidebar minimizado en PC */
@media (min-width: 992px) {
    body.sidebar-collapsed .app-sidebar,
    html.sidebar-collapsed body .app-sidebar {
        width: 72px !important;
        transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    body.sidebar-collapsed .content-wrapper,
    html.sidebar-collapsed body .content-wrapper {
        margin-left: 72px !important;
        transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
}

/* Flechas de navegación para subir y bajar el menú */
.sidebar-scroll-arrow {
    background: #0f172a !important;
    color: #38bdf8 !important;
    border: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding: 0 !important;
    width: 100% !important;
    text-align: center !important;
    cursor: pointer !important;
    font-size: 1rem !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 28px !important;
    min-height: 28px !important;
    flex-shrink: 0 !important;
    z-index: 10 !important;
    user-select: none !important;
    outline: none !important;
}

.sidebar-scroll-arrow i {
    font-size: 1.15rem !important;
    font-weight: bold !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

.sidebar-scroll-arrow:hover {
    background: #2563eb !important;
    color: #ffffff !important;
}

.sidebar-scroll-arrow:active {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

.app-sidebar .nav-link {
    color: #94a3b8;
    font-weight: 500;
    padding: 0.55rem 0.85rem;
    border-radius: 0.5rem;
    margin: 0.1rem 0.6rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 0.88rem;
}

.app-sidebar .nav-link i {
    font-size: 1.15rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
    transition: margin 0.2s ease;
}

.app-sidebar .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.app-sidebar .nav-link.active {
    color: #ffffff;
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.app-sidebar .sidebar-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.85rem 1rem 0.2rem;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s ease;
}

/* Reglas visuales para el modo minimizado */
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-sucursal-text,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .sidebar-footer-text {
    display: none !important;
}

body.sidebar-collapsed .sidebar-heading {
    font-size: 0;
    padding: 0;
    margin: 8px 14px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

body.sidebar-collapsed .app-sidebar .nav-link {
    justify-content: center;
    padding: 0.6rem 0;
    margin: 0.25rem auto;
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

body.sidebar-collapsed .app-sidebar .nav-link i {
    margin-right: 0;
    font-size: 1.25rem;
}

body.sidebar-collapsed .sidebar-sucursal-box {
    justify-content: center !important;
    padding: 8px 0 !important;
}

body.sidebar-collapsed .sidebar-sucursal-box i {
    margin-right: 0 !important;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 10px 8px !important;
}

body.sidebar-collapsed .sidebar-footer a {
    padding: 0.45rem 0 !important;
}

body.sidebar-collapsed #sidebarCollapseBtn i {
    transform: rotate(180deg);
}

/* Mobile Sidebar Offcanvas */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
    }
    .app-sidebar.show {
        left: 0;
        box-shadow: 0 0 25px rgba(0,0,0,0.5);
    }
    .content-wrapper {
        margin-left: 0 !important;
    }
}

.content-wrapper {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Topbar */
.app-topbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Cards & Statistics */
.card-kpi {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.08);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Touch-friendly buttons for POS & Mobile */
.btn-touch {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
}

/* Camera Preview */
.camera-box {
    width: 100%;
    max-width: 480px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    position: relative;
}

.camera-box video {
    width: 100%;
    height: auto;
    display: block;
}

/* Thumbnails */
.img-thumb-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

/* Tables */
.table th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    background-color: #f1f5f9;
}

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

/* Bordes definidos y visibles a simple vista en campos de entrada y selectores */
.form-control,
.form-select,
.input-group-text {
    border: 1.5px solid #94a3b8 !important;
}

.form-control:hover,
.form-select:hover {
    border-color: #64748b !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18) !important;
}

/* Checkboxes y Radios más visibles con borde definido */
.form-check-input {
    border: 2px solid #475569 !important;
    width: 1.25em;
    height: 1.25em;
    cursor: pointer;
    background-color: #ffffff;
}

.form-check-input:checked {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* Placeholders legibles (gris medio sin negrita) para distinguir ejemplo vs dato real */
.form-control::placeholder,
textarea.form-control::placeholder {
    color: #64748b !important;
    font-weight: 400 !important;
    opacity: 0.85 !important;
}

