/* ============================================================
   SISTEMA DE INVENTARIO - MANOR
   Tema: Colorantes & Tintas - Moderno, Azul + Blanco
   Responsivo para desktop y celular
   ============================================================ */

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

:root {
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --primary-50: #E3F2FD;
    --accent: #FF6B35;
    --accent-dark: #E55A2B;
    --sidebar-bg: linear-gradient(180deg, #0D47A1 0%, #1565C0 40%, #1976D2 100%);
    --sidebar-width: 260px;
    --body-bg: #F0F4F8;
    --card-shadow: 0 2px 12px rgba(21, 101, 192, 0.08);
    --card-hover-shadow: 0 8px 25px rgba(21, 101, 192, 0.15);
    --success: #00C853;
    --danger: #FF1744;
    --warning: #FFB300;
    --text-primary: #1A2138;
    --text-secondary: #5A6785;
    --border-color: #E2E8F0;
    --topbar-height: 60px;
}

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* ===== SIDEBAR ===== */
#sidebar {
    background: var(--sidebar-bg);
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.sidebar-brand {
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    backdrop-filter: blur(10px);
}

.sidebar-brand h5 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.sidebar-brand small {
    font-size: 0.7rem;
    opacity: 0.5;
}

.sidebar-section {
    padding: 12px 12px 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    margin-top: 4px;
}

#sidebar nav { padding: 8px; }

#sidebar .nav-link {
    color: rgba(255,255,255,0.75);
    padding: 10px 14px;
    border-radius: 10px;
    margin: 2px 0;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

#sidebar .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

#sidebar .nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    transform: translateX(3px);
}

#sidebar .nav-link.active,
#sidebar .nav-link:focus {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

#sidebar .nav-link.sub-link {
    padding-left: 46px;
    font-size: 0.82rem;
    opacity: 0.85;
}

.sidebar-user {
    padding: 16px;
    margin: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-user .user-role {
    font-size: 0.7rem;
    opacity: 0.6;
    font-weight: 400;
}

.sidebar-logout {
    color: rgba(255,255,255,0.5) !important;
    font-size: 0.82rem !important;
    margin-top: 0 !important;
}

.sidebar-logout:hover {
    color: #FF8A80 !important;
    background: rgba(255,23,68,0.1) !important;
}

/* ===== OVERLAY MOBILE ===== */
#sidebarOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

/* ===== MAIN CONTENT ===== */
#mainContent {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ===== TOP BAR ===== */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#btnToggleSidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    padding: 4px 8px;
    margin-right: 8px;
    cursor: pointer;
    border-radius: 8px;
}

#btnToggleSidebar:hover {
    background: var(--primary-50);
    color: var(--primary);
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 24px;
}

/* ===== CARDS ===== */
.card {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    background: #fff;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--card-hover-shadow);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    font-weight: 600;
    border-radius: 14px 14px 0 0 !important;
}

.card-body { padding: 20px; }

/* Dashboard stat cards */
.card-dashboard {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.card-dashboard::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(135deg, transparent 40%, rgba(21,101,192,0.04));
    border-radius: 0 16px 16px 0;
}

.card-dashboard:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

.stat-icon {
    font-size: 2.2rem;
    opacity: 0.2;
    color: var(--primary) !important;
}

/* ===== TABLES ===== */
.table { font-size: 0.88rem; }

.table th {
    background-color: var(--primary-50);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    border-bottom: 2px solid var(--primary-light);
    white-space: nowrap;
}

.table td {
    padding: 10px 14px;
    vertical-align: middle;
    border-bottom: 1px solid #F0F4F8;
}

.table-hover tbody tr:hover {
    background-color: var(--primary-50);
}

/* ===== BUTTONS ===== */
.btn {
    font-weight: 500;
    border-radius: 10px;
    font-size: 0.88rem;
    padding: 8px 18px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21,101,192,0.3);
}

.btn-success {
    background: #00C853;
    border-color: #00C853;
}

.btn-success:hover {
    background: #00B248;
    border-color: #00B248;
}

.btn-danger {
    background: #FF1744;
    border-color: #FF1744;
}

.btn-info {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: #fff;
}

.btn-info:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
    border-radius: 12px;
}

/* ===== FORMS ===== */
.form-control, .form-select {
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    padding: 9px 14px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(66,165,245,0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ===== BADGES ===== */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 5px 10px;
    border-radius: 8px;
    letter-spacing: 0.3px;
}

.badge-stock-bajo { background-color: var(--danger); }
.badge-stock-medio { background-color: var(--warning); color: #000; }
.badge-stock-ok { background-color: var(--success); }

/* ===== ALERTS ===== */
.alert {
    border-radius: 12px;
    border: none;
    font-size: 0.9rem;
    padding: 14px 20px;
}

.alert-success {
    background: #E8F5E9;
    color: #1B5E20;
    border-left: 4px solid #00C853;
}

.alert-danger {
    background: #FFEBEE;
    color: #B71C1C;
    border-left: 4px solid #FF1744;
}

.alert-warning {
    background: #FFF8E1;
    color: #E65100;
    border-left: 4px solid #FFB300;
}

.alert-info {
    background: var(--primary-50);
    color: var(--primary-dark);
    border-left: 4px solid var(--primary-light);
}

/* ===== CUSTOM COLORS ===== */
.bg-purple { background-color: #7C4DFF !important; }
.bg-teal { background-color: #00BFA5 !important; }
.border-purple { border-color: #7C4DFF !important; }
.text-purple { color: #7C4DFF !important; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    position: relative;
    overflow: hidden;
}

.login-left {
    flex: 1;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
    color: #fff;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 600px;
    height: 600px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}

.login-left::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 500px;
    height: 500px;
    background: rgba(255,107,53,0.08);
    border-radius: 50%;
}

.login-left .brand-big {
    position: relative;
    z-index: 2;
    text-align: center;
}

.login-left .brand-big .icon-circle {
    width: 90px;
    height: 90px;
    background: rgba(255,255,255,0.1);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 2.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.login-left .brand-big h2 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
}

.login-left .brand-big p {
    opacity: 0.6;
    font-size: 0.95rem;
    max-width: 280px;
    line-height: 1.6;
}

/* Color swatches animation */
.color-swatches {
    position: absolute;
    bottom: 60px;
    display: flex;
    gap: 12px;
    z-index: 2;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    animation: floatSwatch 3s ease-in-out infinite;
}

.color-swatch:nth-child(1) { background: #FF6B35; animation-delay: 0s; }
.color-swatch:nth-child(2) { background: #42A5F5; animation-delay: 0.5s; }
.color-swatch:nth-child(3) { background: #00C853; animation-delay: 1s; }
.color-swatch:nth-child(4) { background: #FFB300; animation-delay: 1.5s; }
.color-swatch:nth-child(5) { background: #7C4DFF; animation-delay: 2s; }

@keyframes floatSwatch {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #fff;
}

.login-form-box {
    width: 100%;
    max-width: 400px;
}

.login-form-box h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-form-box .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.login-form-box .form-control {
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.login-form-box .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21,101,192,0.1);
}

.login-form-box .input-group-text {
    border-radius: 12px 0 0 12px;
    border: 2px solid var(--border-color);
    border-right: none;
    background: var(--primary-50);
    color: var(--primary);
}

.login-form-box .input-group .form-control {
    border-radius: 0 12px 12px 0;
    border-left: none;
}

.login-form-box .input-group:focus-within .input-group-text {
    border-color: var(--primary);
}

.login-form-box .btn-login {
    background: var(--primary);
    border: none;
    padding: 13px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    letter-spacing: 0.3px;
    transition: all 0.2s;
}

.login-form-box .btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(21,101,192,0.3);
}

/* ===== SCROLL ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===== PROGRESS BAR (produccion) ===== */
.progress { border-radius: 8px; }
.progress-bar.bg-purple { background-color: #7C4DFF !important; }

/* ===== TPV OVERRIDES ===== */
.tpv-scanner {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%) !important;
}

.tpv-totals {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1A237E 100%) !important;
}

/* ===== RESPONSIVE: TABLET ===== */
@media (max-width: 991.98px) {
    :root { --sidebar-width: 240px; }

    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #sidebarOverlay.show {
        display: block;
    }

    #mainContent {
        margin-left: 0;
    }

    #btnToggleSidebar {
        display: inline-flex;
    }

    .page-content {
        padding: 16px;
    }
}

/* ===== RESPONSIVE: MOBILE ===== */
@media (max-width: 575.98px) {
    :root { --sidebar-width: 280px; }

    .topbar {
        padding: 0 12px;
        height: 54px;
    }

    .topbar-title { font-size: 0.92rem; }

    .page-content {
        padding: 12px;
    }

    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }

    .table { font-size: 0.8rem; }
    .table th, .table td { padding: 8px 10px; }

    h3, .h3 { font-size: 1.3rem; }
    h4, .h4 { font-size: 1.1rem; }

    .btn { font-size: 0.82rem; padding: 7px 14px; }
    .btn-sm { padding: 4px 8px; font-size: 0.75rem; }

    /* Login mobile */
    .login-page { flex-direction: column; }

    .login-left {
        padding: 40px 24px 30px;
        min-height: auto;
    }

    .login-left .brand-big .icon-circle {
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .login-left .brand-big h2 { font-size: 1.3rem; }
    .login-left .brand-big p { font-size: 0.82rem; }
    .color-swatches { bottom: 20px; gap: 8px; }
    .color-swatch { width: 28px; height: 28px; border-radius: 8px; }

    .login-right { padding: 24px; }
    .login-form-box h3 { font-size: 1.3rem; }

    /* Dashboard stat cards - scroll horizontal en mobile */
    .card-dashboard .card-body h3 { font-size: 1.1rem; }
    .stat-icon { font-size: 1.8rem; }

    /* TPV mobile */
    .tpv-scanner { padding: 14px; border-radius: 10px; }
    .tpv-scanner input { font-size: 1rem; padding: 10px; }
    .tpv-totals { padding: 16px; border-radius: 10px; }
    .tpv-totals .total-final { font-size: 1.4rem; }
    .tpv-totals .total-final .monto { font-size: 1.6rem; }
    .btn-cobrar { font-size: 1rem; padding: 12px; }
}

/* ===== PRINT ===== */
@media print {
    #sidebar, .topbar, #btnToggleSidebar { display: none !important; }
    #mainContent { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
