/* ================================================
   SCPM Miura - Estilos principales
   Los colores se configuran en :root para poder
   cambiar toda la paleta en un solo lugar.
   ================================================ */

:root {
    /* ============ PALETA OFICIAL MIURA ============
       Rojo Miura:   #da3507  (extraído del logo)
       Negro Miura:  #1f1410  (negro carbón cálido del logo)
       Blanco:       #ffffff
    */
    --color-primary: #1f1410;          /* negro carbón Miura - sidebar y headings */
    --color-primary-dark: #0d0807;     /* negro más profundo - hover */
    --color-primary-light: #2d1f19;    /* variación clara del negro */
    --color-secondary: #da3507;        /* rojo Miura - acentos, botones, activo */
    --color-secondary-dark: #b12913;   /* rojo oscuro - hover de rojos */
    --color-accent: #fdeae3;           /* rojo muy diluido para fondos suaves */

    --color-bg: #f7f5f4;               /* fondo general - blanco con tinte cálido */
    --color-white: #ffffff;
    --color-text: #1f1410;             /* texto principal en negro Miura */
    --color-text-muted: #7a6e68;       /* gris cálido */
    --color-border: #e8e2df;           /* borde sutil cálido */

    --color-success: #2e7d32;
    --color-warning: #ed6c02;
    --color-danger: #da3507;            /* el rojo Miura sirve también como danger */
    --color-info: #0277bd;

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

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

/* ================= SIDEBAR ================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 22px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.15);
}
.sidebar-brand img {
    max-width: 170px;
    height: auto;
    display: block;
}
.logo-box {
    width: 42px; height: 42px;
    background: var(--color-secondary);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-white);
    font-size: 20px;
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-subtitle { font-size: 11px; opacity: 0.7; }

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: rgba(255,255,255,0.8);
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}
.nav-item i { width: 18px; text-align: center; }
.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.nav-item.active {
    background: var(--color-secondary);
    color: var(--color-white);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(218, 53, 7, 0.4);
}

.sidebar-footer {
    padding: 12px 18px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 11px;
    opacity: 0.5;
}

/* ================= MAIN AREA ================= */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { font-size: 18px; font-weight: 600; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lang-switch {
    display: flex;
    background: var(--color-accent);
    border-radius: var(--radius);
    padding: 2px;
}
.lang-btn {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    color: var(--color-text-muted);
}
.lang-btn.active {
    background: var(--color-secondary);
    color: var(--color-white);
    box-shadow: var(--shadow-sm);
}

.topbar-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--color-accent);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-secondary);
}
.topbar-icon:hover { background: var(--color-secondary); color: #fff; }

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 16px;
    border-left: 1px solid var(--color-border);
}
.user-info { text-align: right; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--color-text-muted); }
.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--color-secondary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(218, 53, 7, 0.3);
}
.logout-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--color-accent);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-text-muted);
}
.logout-btn:hover { background: var(--color-danger); color: #fff; }

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

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #d4edda; color: #155724; }
.alert-error   { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info    { background: #d1ecf1; color: #0c5460; }

/* ================= CARDS ================= */
.card {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}
.card-title { font-size: 15px; font-weight: 600; }

/* Grids */
.grid {
    display: grid;
    gap: 16px;
}
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .main-area { margin-left: 0; }
}

/* ================= STAT CARDS (dashboard) ================= */
.stat-card {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    background: var(--color-accent);
    color: var(--color-secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.stat-icon.success { background: #d4edda; color: var(--color-success); }
.stat-icon.warning { background: #fff3cd; color: var(--color-warning); }
.stat-icon.danger  { background: #f8d7da; color: var(--color-danger); }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ================= TABLES ================= */
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.table th {
    background: var(--color-accent);
    color: var(--color-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}
.table tr:hover td { background: #fafbfd; }

/* ================= BUTTONS ================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn-secondary { background: var(--color-accent); color: var(--color-primary); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ================= BADGES ================= */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-info    { background: #d1ecf1; color: #0c5460; }

/* ================= FORMS ================= */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--color-text);
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}

/* ================= LOGIN ================= */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(31,20,16,0.97) 0%, rgba(13,8,7,0.99) 100%),
        radial-gradient(circle at 20% 30%, var(--color-secondary) 0%, transparent 50%);
    background-color: var(--color-primary);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-wrap::before {
    content: '';
    position: absolute;
    top: -100px; right: -100px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(218,53,7,0.2) 0%, transparent 70%);
    border-radius: 50%;
}
.login-wrap::after {
    content: '';
    position: absolute;
    bottom: -150px; left: -100px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(218,53,7,0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.login-card {
    background: var(--color-white);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    border-top: 4px solid var(--color-secondary);
}
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo img {
    max-width: 180px;
    height: auto;
}
.login-title { text-align: center; font-size: 18px; font-weight: 600; margin-bottom: 4px; color: var(--color-text); }
.login-subtitle { text-align: center; color: var(--color-text-muted); font-size: 13px; margin-bottom: 28px; }
.login-btn {
    width: 100%;
    padding: 13px;
    background: var(--color-secondary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.login-btn:hover { background: var(--color-secondary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(218,53,7,0.4); }
