@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

/* ===================================================
   SAMEX INDUSTRIAL ENGINE â€” Design System v3.0
   =================================================== */

:root {
    --red:        #e63030;
    --red-dim:    rgba(230, 48, 48, 0.15);
    --red-glow:   rgba(230, 48, 48, 0.35);
    --bg:         #080808;
    --surface:    #111111;
    --surface-2:  #191919;
    --border:     rgba(255,255,255,0.07);
    --border-red: rgba(230, 48, 48, 0.4);
    --text:       #f0f0f0;
    --muted:      #a0aabf;
    --success:    #22c55e;
    --warning:    #f59e0b;
    --sidebar-w:  250px;
    --info:       #00d2ff;
    --radius:     12px;
    --radius-lg:  18px;
    --ease:       cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    /* Subtle radial background */
    background-image:
        radial-gradient(ellipse 60% 40% at 0% 0%, rgba(230,48,48,0.04) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 100% 100%, rgba(230,48,48,0.03) 0%, transparent 60%);
    background-attachment: fixed;
}

/* ===================================================
   LAYOUT
   =================================================== */
.app-container { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

/* LOGO */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0.5rem;
    margin-bottom: 2.5rem;
    flex-shrink: 0;
}

.logo i {
    font-size: 1.3rem;
    color: var(--red);
    filter: drop-shadow(0 0 6px var(--red-glow));
}

.logo > div > div:first-child {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
}

.logo span {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    -webkit-text-fill-color: unset;
    background: none;
    display: block;
    margin-top: 1px;
}

/* NAV */
.nav-menu { list-style: none; flex: 1; }
.nav-item { margin-bottom: 2px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s var(--ease);
    border: 1px solid transparent;
}

.nav-link i { width: 18px; text-align: center; font-size: 0.9rem; }

.nav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-link.active {
    background: var(--red);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(230, 48, 48, 0.3);
}

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem 2.5rem;
    min-height: 100vh;
}

/* ===================================================
   HEADER (per-page, inside views)
   =================================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 1.75rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.page-title p {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--red);
    margin-bottom: 3px;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1.1;
}

/* No global header bar needed â€” views own their headers */

/* ===================================================
   CARDS & GLASS
   =================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: border-color 0.3s, transform 0.3s var(--ease), box-shadow 0.3s;
}

.card:hover {
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ===================================================
   KPI / STATS GRID â€” ALWAYS HORIZONTAL
   =================================================== */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid transparent;
    background: var(--surface);
}

.stat-card:hover {
    border-bottom-color: var(--red);
    transform: none;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--red-dim), transparent 70%);
    transform: translate(30%, -30%);
    pointer-events: none;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #c8d0e0;
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

/* ===================================================
   TABLES
   =================================================== */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-top: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead { background: var(--surface-2); }

th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #c8d0e0;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.95rem;
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: rgba(255,255,255,0.03); }

/* ===================================================
   INPUTS & FORMS
   =================================================== */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #c8d0e0;
}

input, select, textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    width: 100%;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-dim);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Inline table inputs (transparent) */
.input-inline {
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid transparent !important;
    border-radius: 0 !important;
    padding: 5px 6px !important;
    font-size: 0.95rem;
    transition: border-color 0.2s !important;
    box-shadow: none !important;
}

.input-inline:hover {
    border-bottom-color: rgba(255,255,255,0.15) !important;
}

.input-inline:focus {
    border-bottom-color: var(--red) !important;
    box-shadow: none !important;
}

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}

.btn-primary {
    background: var(--red);
    color: #fff;
    box-shadow: 0 4px 14px rgba(230, 48, 48, 0.35);
}

.btn-primary:hover {
    background: #c82020;
    box-shadow: 0 6px 20px rgba(230, 48, 48, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.15);
}

/* ===================================================
   BADGES
   =================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ===================================================
   STAIRCASE (Dashboard breakdown)
   =================================================== */
.staircase-container { display: flex; flex-direction: column; gap: 0.6rem; }

.staircase-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-left-width: 4px;
    transition: transform 0.25s var(--ease), background 0.2s;
}

.staircase-step:hover {
    transform: translateX(5px);
    background: rgba(255,255,255,0.04);
}

/* ===================================================
   MODAL
   =================================================== */
.modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ===================================================
   ANIMATIONS
   =================================================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade { animation: fadeUp 0.45s var(--ease) both; }

/* ===================================================
   SCROLLBAR
   =================================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ===================================================
   UTILS
   =================================================== */
.text-red   { color: var(--red); }
.text-green { color: var(--success); }
.text-muted { color: var(--muted); }
.fw-800     { font-weight: 800; }
.mono       { font-family: 'Courier New', monospace; }

/* ===================================================
   FINAL POLISH v3.1
   =================================================== */

/* Subtle grid background overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.app-container { position: relative; z-index: 1; }

/* â”€â”€ Staggered KPI card animation â”€â”€ */
.stats-grid .stat-card:nth-child(1) { animation-delay: 0ms; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 60ms; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 120ms; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 180ms; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stats-grid .stat-card {
    animation: slideIn 0.4s var(--ease) both;
}

/* â”€â”€ Nav group separator â”€â”€ */
.nav-sep {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    padding: 1rem 0.85rem 0.35rem;
}

/* â”€â”€ Active sidebar link glow â”€â”€ */
.nav-link.active {
    box-shadow: 0 4px 14px rgba(230, 48, 48, 0.35),
                inset 0 1px 0 rgba(255,255,255,0.1);
}

/* â”€â”€ Select styling â”€â”€ */
select option {
    background: #1a1a1a;
    color: #f0f0f0;
    padding: 8px;
}

/* â”€â”€ Number inputs: hide spinners â”€â”€ */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

/* â”€â”€ Card subtle inner glow â”€â”€ */
.card {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

/* â”€â”€ Stat value emphasis â”€â”€ */
.stat-value {
    font-variant-numeric: tabular-nums;
}

/* â”€â”€ Table monospace values â”€â”€ */
.table-container td:last-child,
.table-container td:nth-last-child(2) {
    font-variant-numeric: tabular-nums;
}

/* â”€â”€ Btn active press effect â”€â”€ */
.btn:active {
    transform: scale(0.98) translateY(0) !important;
}

/* â”€â”€ Header bottom line accent â”€â”€ */
.header {
    position: relative;
}
.header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 48px; height: 2px;
    background: var(--red);
    border-radius: 2px;
}

/* ===================================================
   VISUAL SCALE IMPROVEMENTS v3.2
   =================================================== */

/* Table select dropdowns â€” more readable inside cells */
td select {
    font-size: 0.92rem;
    padding: 6px 8px;
    min-width: 120px;
}

/* Table number inputs */
td input[type=number] {
    font-size: 1rem;
}

/* Subtle row alternation for long tables */
tbody tr:nth-child(even) td {
    background: rgba(255,255,255,0.01);
}

/* Bigger delete/action icon buttons in tables */
td button i {
    font-size: 1.1rem;
}

/* Category label in table â€” more prominent */
td select[style*='uppercase'] {
    font-size: 0.85rem !important;
    letter-spacing: 1px;
}

/* Form labels â€” slightly bigger */
.form-group label {
    font-size: 0.75rem;
}

/* Page subtitle (Module indicator) */
.page-title p {
    font-size: 0.75rem;
}

/* Bigger page title */
.page-title h1 {
    font-size: 2rem;
}

/* Badge danger */
.badge-danger {
    background: rgba(230, 48, 48, 0.12);
    color: var(--red);
    border: 1px solid rgba(230, 48, 48, 0.3);
}

/* Estilos para impresión (Ficha Técnica) */
@media print {
    .sidebar, .navbar, .btn, .breadcrumb, .page-title p { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .card, .table-container { border: 1px solid #eee !important; background: #fff !important; box-shadow: none !important; }
    th, td { border-bottom: 1px solid #eee !important; color: #000 !important; }
    .badge-success { border: 1px solid #22c55e !important; color: #166534 !important; }
    .tab-talla:not(.btn-primary) { display: none !important; }
    .tab-talla.btn-primary { background: #000 !important; color: #fff !important; padding: 10px !important; }
}
