/* ============================================================
   SISTEMA DE INVENTARIO - ZAPATILLAS
   Estilos principales
   ============================================================ */

/* Variables */
:root {
    --primary:     #4F46E5;
    --primary-dark:#3730A3;
    --secondary:   #6B7280;
    --success:     #10B981;
    --danger:      #EF4444;
    --warning:     #F59E0B;
    --bg:          #F3F4F6;
    --card:        #FFFFFF;
    --text:        #111827;
    --text-muted:  #6B7280;
    --border:      #E5E7EB;
    --sidebar-w:   240px;
    --sidebar-bg:  #1E1B4B;
    --sidebar-txt: #C7D2FE;
    --sidebar-active: #4F46E5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== LAYOUT ===== */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

.brand-icon { font-size: 24px; }
.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.5px;
}

.sidebar-nav { padding: 12px 8px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--sidebar-txt);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-active);
    color: #FFFFFF;
}

.nav-icon { font-size: 16px; }

/* ===== MAIN ===== */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 24px;
    max-width: calc(100vw - var(--sidebar-w));
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ===== BOTONES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #D1D5DB; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ===== ALERTAS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.alert-danger  { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }

.alert ul { margin: 6px 0 0 18px; }

/* ===== BUSCADOR ===== */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: var(--card);
}

.search-input:focus { border-color: var(--primary); }

/* ===== CARD ===== */
.card {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

/* ===== TABLA ===== */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #F9FAFB;
    padding: 11px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #F9FAFB; }

.table-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.table-img-placeholder {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 6px;
    font-size: 22px;
    border: 1px solid var(--border);
}

.actions { display: flex; gap: 4px; }

.text-muted { color: var(--text-muted); font-size: 12px; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-code    { background: #EEF2FF; color: #3730A3; font-family: monospace; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { color: var(--text-muted); margin-bottom: 16px; }

/* ===== FORMULARIO ===== */
.form { padding: 4px; }

.form-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 13px;
}

.required { color: var(--danger); }

.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: #fff;
    transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--primary); }

.form-hint {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 20px 24px;
    background: #F9FAFB;
    border-top: 1px solid var(--border);
}

/* ===== VER PRODUCTO ===== */
.ver-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}

.producto-info {
    padding: 20px;
}

.producto-imagen {
    width: 100%;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.producto-imagen-placeholder {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 16px;
}

.producto-detalle { display: flex; flex-direction: column; gap: 10px; }

.detalle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.detalle-row:last-child { border-bottom: none; }

.detalle-label { color: var(--text-muted); font-weight: 500; }
.detalle-valor { color: var(--text); text-align: right; }

.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

/* ===== CARD HEADER ===== */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
}

/* ===== TALLA BADGE ===== */
.talla-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ===== IMAGEN PREVIEW (editar) ===== */
.imagen-actual {
    margin-bottom: 12px;
}

.imagen-preview {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
    margin-bottom: 6px;
}
/* ============================================================
   RESPONSIVE — MÓVIL Y TABLET
   ============================================================ */
.menu-toggle {
    display: none;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 1100;
    width: 44px; height: 44px;
    border: none; border-radius: 10px;
    background: var(--sidebar-bg); color: #fff;
    font-size: 22px; cursor: pointer;
    align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}
@media (max-width: 900px) {
    .menu-toggle { display: flex; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 1050; width: 260px;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main {
        margin-left: 0; max-width: 100vw;
        padding: 16px; padding-top: 70px;
    }
    .page-header { flex-direction: column; gap: 12px; }
    .header-actions { width: 100%; flex-wrap: wrap; }
    .form-row { grid-template-columns: 1fr; }
    .ver-grid { grid-template-columns: 1fr; }
    .btn { padding: 10px 16px; }
}
@media (max-width: 560px) {
    .page-title { font-size: 19px; }
    .stats-grid, .dashboard-cards, .cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .table th, .table td { padding: 9px 10px; font-size: 12px; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }
}
