/* ============================================
   styles.css - Estilos del Dashboard ERP
   ============================================ */

/* ----- Variables (igual) ----- */
:root {
    --primary: #1a2a3a;
    --primary-light: #2c3e50;
    --accent: #7b9cff;
    --accent-hover: #5a7fdb;
    --bg-main: #f0f4f9;
    --bg-card: #ffffff;
    --text-dark: #0b1a2a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    --radius: 16px;
    --transition: 0.3s ease;
}

/* Reset y base (igual) */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    display: flex;
    min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* SIDEBAR (igual) */
.sidebar {
    width: 260px;
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    transition: transform var(--transition);
    z-index: 100;
}
.sidebar-brand {
    padding: 1.8rem 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-icon { font-size: 1.8rem; color: var(--accent); }
.brand-name { font-size: 1.25rem; font-weight: 500; letter-spacing: -0.02em; }
.brand-name strong { font-weight: 700; color: var(--accent); }
/* ===== ESTILOS DEL LOGO DE TEXTO (SUPER INKA LAB) ===== */
.sidebar-brand-text {
    font-family: 'Orbitron', Arial, sans-serif;
    font-style: italic;
    font-weight: 900;
    font-size: 1.3rem;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    line-height: 1.2;
    text-align: center;
}

.sidebar-brand-text .text-green {
    background: linear-gradient(180deg, #38a135 0%, #175e18 60%, #0c380e 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.5));
    color: #38a135; /* color de respaldo */
}

.sidebar-brand-text .text-gold {
    background: linear-gradient(180deg, #fff099 0%, #e5bc3f 45%, #a3751a 85%, #6e4c07 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.5));
    color: #e5bc3f; /* color de respaldo */
}

.sidebar-brand-text .text-small {
    font-size: 0.9rem;
    display: inline-block;
    margin-left: 2px;
}
.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0.75rem;
}
.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
}
.sidebar-nav ul li a i { width: 1.3rem; text-align: center; font-size: 1.1rem; }
.sidebar-nav ul li a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav ul li.active a {
    background: rgba(123,156,255,0.15);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-nav ul li.logout {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 0.75rem;
}
.sidebar-nav ul li.logout a { color: rgba(255,255,255,0.5); }
.sidebar-nav ul li.logout a:hover { color: #ff6b6b; background: rgba(255,107,107,0.08); }
.sidebar-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.3;
    border-top: 1px solid rgba(255,255,255,0.04);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    padding: 1.5rem 2rem 2rem;
    overflow-x: hidden;
    min-width: 0;
}

/* TOPBAR (igual) */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0 1.5rem 0;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 200px;
}
.menu-toggle {
    font-size: 1.4rem;
    color: var(--text-muted);
    display: none;
    padding: 0.3rem;
}
.menu-toggle:hover { color: var(--text-dark); }
.search-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 30px;
    padding: 0.4rem 1.2rem;
    border: 1px solid var(--border-color);
    transition: border 0.2s, box-shadow 0.2s;
    flex: 1;
    max-width: 400px;
}
.search-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(123,156,255,0.12);
}
.search-wrapper i { color: var(--text-muted); font-size: 0.95rem; margin-right: 0.7rem; }
.search-wrapper input {
    border: none;
    outline: none;
    background: transparent;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    width: 100%;
    font-family: inherit;
}
.search-wrapper input::placeholder { color: #94a3b8; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}
.notif-btn {
    position: relative;
    font-size: 1.3rem;
    color: var(--text-muted);
    padding: 0.3rem;
    transition: color 0.2s;
}
.notif-btn:hover { color: var(--text-dark); }
.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-dropdown { position: relative; }
.profile-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.2rem 0.8rem 0.2rem 0.4rem;
    border-radius: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: border 0.2s, box-shadow 0.2s;
}
.profile-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.profile-btn img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}
.profile-btn span { font-weight: 500; font-size: 0.9rem; color: var(--text-dark); }
.profile-btn i { font-size: 0.7rem; color: var(--text-muted); }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 20px 40px -12px rgba(0,0,0,0.15);
    min-width: 200px;
    padding: 0.5rem 0;
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
    z-index: 50;
}
.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1.2rem;
    color: var(--text-dark);
    font-size: 0.9rem;
    transition: background 0.15s;
}
.dropdown-menu a:hover { background: var(--bg-main); }
.dropdown-menu hr { margin: 0.3rem 0; border: none; border-top: 1px solid var(--border-color); }
.dropdown-menu a i { width: 1.2rem; color: var(--text-muted); }

/* DASHBOARD */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

/* KPI Cards (igual) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.2rem;
}
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem 1.5rem 1.3rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 30px -8px rgba(0,0,0,0.08);
}
.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    flex-shrink: 0;
}
.kpi-icon.blue { background: #7b9cff; }
.kpi-icon.green { background: #38a169; }
.kpi-icon.orange { background: #ed8936; }
.kpi-icon.purple { background: #805ad5; }
.kpi-info { flex: 1; }
.kpi-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); font-weight: 600; }
.kpi-value { display: block; font-size: 1.6rem; font-weight: 700; margin: 0.1rem 0 0.2rem; }
.kpi-change { font-size: 0.75rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.25rem; }
.kpi-change.positive { color: #38a169; }
.kpi-change.negative { color: #e53e3e; }

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}
.chart-card, .activity-card, .table-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}
.card-header h3 { font-size: 1.05rem; font-weight: 600; }
.card-header .badge {
    background: var(--bg-main);
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}
.card-header .link { font-size: 0.85rem; color: var(--accent); font-weight: 500; }
.card-header .link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ----- GRÁFICO DE DOBLE BARRA ----- */
.bar-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 200px;
    gap: 0.3rem;
    padding-top: 0.5rem;
}
.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
}
.bar-group {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 3px;
    height: 180px;
    width: 100%;
}
.bar {
    width: 16px;
    min-height: 4px;
    border-radius: 4px 4px 0 0;
    transition: height 0.6s ease;
}
.bar-venta {
    background: var(--accent);
}
.bar-compra {
    background: #38a169;
}
.bar-item span {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* Activity list (igual) */
.activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.activity-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    font-size: 0.9rem;
    line-height: 1.4;
}
.activity-list li i {
    font-size: 1.1rem;
    margin-top: 0.1rem;
    width: 1.4rem;
    text-align: center;
}
.activity-list li .green { color: #38a169; }
.activity-list li .blue { color: var(--accent); }
.activity-list li .orange { color: #ed8936; }
.activity-list li .purple { color: #805ad5; }
.activity-list li div { flex: 1; }
.activity-list li .time { display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 0.1rem; }

/* Tabla (igual) */
.table-card { padding: 1.5rem; }
.table-responsive { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
thead { background: var(--bg-main); border-radius: 8px; }
th {
    text-align: left;
    padding: 0.7rem 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
}
tr:last-child td { border-bottom: none; }
.status {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
}
.status.completed { background: #c6f6d5; color: #276749; }
.status.pending { background: #fefcbf; color: #975a16; }
.status.shipped { background: #bee3f8; color: #2a69ac; }
.status.cancelled { background: #fed7d7; color: #9b2c2c; }

/* Responsive (igual) */
@media (max-width: 1024px) { .charts-row { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        width: 280px;
        height: 100vh;
        top: 0;
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .main-content { padding: 1rem; }
    .topbar { padding-bottom: 1rem; }
    .search-wrapper { max-width: 100%; }
    .profile-btn span { display: none; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi-card { padding: 1rem; }
    .kpi-value { font-size: 1.3rem; }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar-left { flex: 1 1 100%; }
    .topbar-right { width: 100%; justify-content: flex-end; }
    .bar-chart { height: 120px; }
    .bar { width: 12px; }
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 90;
}
.sidebar-overlay.active { display: block; }