/* =============================================
   LUXPRO CONTROL ERP - Estilos personalizados
   Inspirado en interfaces tipo rentman.io: limpio, moderno, mucho whitespace
   ============================================= */

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    background: #f8fafc;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: #0f172a; letter-spacing: -0.01em; }

/* Las variables de tema se inyectan dinámicamente desde el layout
   (views/includes/app.php) en :root usando el helper config('color_*').
   Estos son los defaults si por algún motivo el layout no inyecta. */
:root {
    --color-primary:    #0f172a;
    --color-accent:     #0ea5e9;
    --color-accent-dk:  #0284c7;
    --color-success:    #10b981;
    --color-warning:    #f59e0b;
    --color-danger:     #ef4444;
    --color-sidebar:    #1e293b;
    --color-sidebar-h:  #334155;
    --color-sidebar-texto: #cbd5e1;
    --color-primario:   #0ea5e9;
    --color-secundario: #0f172a;
    --color-acento:     #10b981;
    --color-peligro:    #ef4444;
    --sidebar-width:    260px;
}

/* Si el layout inyecta valores en html, estos ganan */
html {
    --color-sidebar: var(--color-sidebar, #1e293b);
    --color-primary: var(--color-primary, #0f172a);
    --color-accent:  var(--color-accent,  #0ea5e9);
}

/* Botones primarios de Bootstrap usando color de tema */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.4rem 0.9rem;
    transition: all 0.15s;
    font-size: 0.875rem;
}
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-primary {
    background-color: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--color-accent-dk, #0284c7) !important;
    border-color: var(--color-accent-dk, #0284c7) !important;
    transform: translateY(-1px);
}
.btn-success {
    background-color: var(--color-success, #10b981) !important;
    border-color: var(--color-success, #10b981) !important;
}
.btn-danger {
    background-color: var(--color-danger, #ef4444) !important;
    border-color: var(--color-danger, #ef4444) !important;
}
.btn-outline-secondary, .btn-outline-primary, .btn-outline-info, .btn-outline-warning, .btn-outline-danger {
    font-weight: 500;
}

/* Cards modernas con bordes muy sutiles */
.card {
    border-radius: 10px;
    border: 1px solid #eef2f7;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.card.border-0.shadow-sm { box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important; }
.card-header {
    background: transparent;
    border-bottom: 1px solid #eef2f7;
    padding: 1rem 1.25rem;
    font-weight: 600;
}
.card-header h5, .card-header h6 { margin: 0; font-weight: 600; }

/* Tablas limpias tipo rentman */
.table {
    margin-bottom: 0;
    --bs-table-color: #334155;
}
.table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.85rem 0.75rem;
    white-space: nowrap;
}
.table tbody td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.table-hover > tbody > tr:hover {
    background-color: #f8fafc;
    transition: background 0.15s;
}
.table > :not(caption) > * > * { border-bottom-color: #f1f5f9; }

/* Badges modernos con bordes suaves */
.badge {
    font-weight: 500;
    padding: 0.3em 0.6em;
    border-radius: 6px;
    font-size: 0.75rem;
    letter-spacing: 0.2px;
}

/* Formularios limpios */
.form-control, .form-select {
    border-radius: 6px;
    border-color: #e2e8f0;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}
.form-label { font-weight: 500; font-size: 0.85rem; color: #475569; margin-bottom: 0.35rem; }

/* Inputs de texto de busqueda */
input[type="text"]:focus, input[type="search"]:focus { box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1); }

/* Alerts */
.alert {
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.875rem;
}
.alert-info { background: #f0f9ff; border-color: #bae6fd; color: #0369a1; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* Progress bar más fina */
.progress { border-radius: 6px; height: 0.5rem !important; overflow: hidden; }

/* Clases utilitarias de color con tema */
.bg-tema { background-color: var(--color-accent) !important; color:#fff; }
.text-tema { color: var(--color-accent) !important; }
.text-tema-secundario { color: var(--color-primary) !important; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: #f8fafc;
    color: #334155;
    -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.wrapper { display: flex; min-height: 100vh; }

#sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    color: #cbd5e1;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--color-sidebar-h);
    text-align: center;
}

.brand {
    color: var(--color-accent);
    margin: 0;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav { padding: 0.75rem 0; }
.sidebar-nav .nav-link {
    color: #cbd5e1;
    padding: 0.55rem 1.25rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    font-size: 0.9rem;
    font-weight: 400;
}
.sidebar-nav .nav-link:hover { background: var(--color-sidebar-h); color: #fff; }
.sidebar-nav .nav-link.active {
    background: var(--color-sidebar-h);
    color: #fff;
    border-left-color: var(--color-accent);
    font-weight: 500;
}
.sidebar-nav .nav-link i { margin-right: 0.6rem; width: 18px; }
.nav-section {
    padding: 0.85rem 1.25rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 1.5px;
}
.nav-item .badge { font-size: 0.65rem; padding: 0.2em 0.5em; }

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

.topbar {
    background: #fff;
    padding: 0.85rem 1.75rem;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.topbar h5 { margin: 0; font-weight: 600; }
.user-menu { color: #1e293b; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; }
.user-menu i { font-size: 1.4rem; color: var(--color-accent); }

.content { flex: 1; padding: 1.75rem; }

.footer {
    background: #fff;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid #eef2f7;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8rem;
}

/* ===== Tarjetas KPI ===== */
.kpi-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.35rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    border: 1px solid #eef2f7;
    height: 100%;
    transition: transform 0.15s, box-shadow 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); }
.kpi-card .kpi-icon {
    width: 44px; height: 44px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    margin-bottom: 0.85rem;
}
.kpi-card .kpi-value { font-size: 1.7rem; font-weight: 700; margin: 0; color: #0f172a; line-height: 1.2; }
.kpi-card .kpi-label { font-size: 0.8rem; color: #94a3b8; margin: 0; font-weight: 500; }
.kpi-card .kpi-value { font-size: 1.8rem; font-weight: 700; margin: 0; color: #0f172a; }
.kpi-card .kpi-label { font-size: 0.85rem; color: #64748b; margin: 0; }
.kpi-icon.bg-primary  { background: var(--color-accent); }
.kpi-icon.bg-success  { background: var(--color-success); }
.kpi-icon.bg-warning  { background: var(--color-warning); }
.kpi-icon.bg-danger   { background: var(--color-danger); }
.kpi-icon.bg-info     { background: #6366f1; }
.kpi-icon.bg-dark     { background: var(--color-primary); }

/* ===== Login ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0ea5e9 100%);
    padding: 1rem;
}
.login-card {
    background: rgba(255,255,255,0.98);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.login-card .brand-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-card .brand-logo h2 {
    color: var(--color-primary);
    font-weight: 800;
    letter-spacing: 2px;
    margin: 0.5rem 0 0;
}
.login-card .brand-logo i {
    font-size: 3rem;
    color: var(--color-accent);
}
.login-card .brand-logo small { color: #64748b; letter-spacing: 3px; }

.login-card .form-control {
    padding: 0.7rem 0.9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.5rem;
}
.login-card .form-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 0.2rem rgba(14,165,233,0.15);
}
.login-card .btn-primary {
    background: var(--color-accent);
    border: none;
    padding: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 0.5rem;
}
.login-card .btn-primary:hover { background: var(--color-accent-dk); }

/* ===== Tablas ===== */
.table-card {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.table-card .table { margin: 0; }
.table-card .table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
}
.table-card .table tbody tr:hover { background: #f8fafc; }

/* ===== Estado badges ===== */
.estado {
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.estado-disponible     { background: #d1fae5; color: #065f46; }
.estado-reservado      { background: #fef3c7; color: #92400e; }
.estado-picking        { background: #dbeafe; color: #1e40af; }
.estado-cargado        { background: #e0e7ff; color: #3730a3; }
.estado-transporte     { background: #cffafe; color: #155e75; }
.estado-evento         { background: #fce7f3; color: #9d174d; }
.estado-retorno        { background: #fed7aa; color: #9a3412; }
.estado-mantenimiento  { background: #fee2e2; color: #991b1b; }
.estado-fuera          { background: #fecaca; color: #7f1d1d; }
.estado-borrador       { background: #e5e7eb; color: #374151; }
.estado-enviada        { background: #dbeafe; color: #1e40af; }
.estado-aceptada       { background: #d1fae5; color: #065f46; }
.estado-rechazada      { background: #fee2e2; color: #991b1b; }
.estado-planificado    { background: #e0e7ff; color: #3730a3; }
.estado-confirmado     { background: #d1fae5; color: #065f46; }
.estado-preparacion    { background: #fef3c7; color: #92400e; }
.estado-curso          { background: #fce7f3; color: #9d174d; }
.estado-finalizado     { background: #e5e7eb; color: #374151; }

/* ===== Botones acción ===== */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 0.4rem;
    margin: 0 0.1rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: inline-block !important; }
}
.sidebar-toggle { display: none; }

/* ============================================
   LOGIN OSCURO (estilo moderno)
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    background: var(--bg-primary);
    background-image:
        radial-gradient(at 20% 30%, rgba(249, 115, 22, 0.15) 0px, transparent 50%),
        radial-gradient(at 80% 70%, rgba(168, 85, 247, 0.1) 0px, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-card .brand-logo {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}
.login-card .brand-logo i {
    font-size: 3rem;
    color: var(--accent-orange);
}
.login-card .brand-logo img {
    max-height: 80px;
    max-width: 100%;
    margin-bottom: 12px;
}
.login-card h2 {
    font-weight: 700;
    color: var(--text-primary);
    margin: 8px 0 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.login-card small {
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 0.7rem;
}
