/* ============================================================
   STARPLIX — Design System Global
   Herramienta SEO personal
   ============================================================ */

/* --- Variables globales de color y tipografía --- */
:root {
    --bg-dark:       #0a0c10;       /* fondo principal oscuro */
    --bg-card:       #111318;       /* fondo de tarjetas/sidebar */
    --bg-hover:      #1a1d24;       /* hover en sidebar/elementos */
    --border:        #1f2330;       /* bordes sutiles */
    --accent:        #7c3aed;       /* violeta — acento principal */
    --accent-glow:   rgba(124, 58, 237, 0.25); /* glow del acento */
    --accent2:       #06b6d4;       /* cyan — acento secundario */
    --text-primary:  #f0f2f8;       /* texto principal */
    --text-secondary:#8b92a8;       /* texto secundario/labels */
    --text-muted:    #4a5068;       /* texto desactivado */
    --success:       #10b981;       /* verde éxito */
    --warning:       #f59e0b;       /* amarillo alerta */
    --danger:        #ef4444;       /* rojo error */
    --radius:        10px;          /* borde redondeado estándar */
    --radius-lg:     16px;          /* borde redondeado grande */
    --font-main:     'Sora', sans-serif;
    --shadow-card:   0 4px 24px rgba(0,0,0,0.4);
    --shadow-glow:   0 0 30px rgba(124, 58, 237, 0.15);
    --transition:    0.2s ease;
}

/* --- Reset base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }

/* ============================================================
   LAYOUT — Sidebar + Main
   ============================================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    padding: 0 0 24px 0;
}

/* Logo en el sidebar */
.sidebar-logo {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.sidebar-logo .logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo .logo-tag {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Navegación del sidebar */
.sidebar-nav {
    flex: 1;
    padding: 0 12px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--text-primary);
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active .nav-icon { opacity: 1; }

/* Badge en nav (próximamente, nuevo...) */
.nav-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Info del usuario en el fondo del sidebar */
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* --- Main content area --- */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header top bar --- */
.topbar {
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Área principal de contenido */
.page-content {
    padding: 32px;
    flex: 1;
}

/* ============================================================
   COMPONENTES — Cards, Botones, Inputs
   ============================================================ */

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    color: var(--accent);
}

/* --- Stats cards en el dashboard --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow: var(--shadow-glow);
}

/* Línea de acento izquierda en stat-card */
.stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--accent), var(--accent2));
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* --- Botones --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
}

/* Botón primario — violeta sólido */
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}
.btn-primary:hover {
    background: #6d28d9;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
    transform: translateY(-1px);
    color: #fff;
}

/* Botón secundario — borde */
.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* Botón danger */
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Botón pequeño */
.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

/* --- Inputs y formularios --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 16px;
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Select */
select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b92a8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

/* --- Tabla --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

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

thead th {
    background: var(--bg-hover);
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 13px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* --- Badges de estado --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-info {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent2);
    border: 1px solid rgba(6, 182, 212, 0.25);
}

/* --- Alerts --- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    color: #67e8f9;
}

/* --- Divider --- */
.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* ============================================================
   LOGIN PAGE — pantalla de acceso
   ============================================================ */

.login-page {
    min-height: 100vh;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* Rejilla decorativa de fondo */
    background-image:
        linear-gradient(rgba(124, 58, 237, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-main {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.login-logo .logo-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   UTILIDADES
   ============================================================ */

.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.gap-16        { gap: 16px; }
.gap-24        { gap: 24px; }
.mt-8          { margin-top: 8px; }
.mt-16         { margin-top: 16px; }
.mt-24         { margin-top: 24px; }
.mb-16         { margin-bottom: 16px; }
.mb-24         { margin-bottom: 24px; }
.text-sm       { font-size: 13px; }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-accent   { color: var(--accent); }
.text-right    { text-align: right; }
.fw-600        { font-weight: 600; }
.w-100         { width: 100%; }

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   RESPONSIVE — colapsa sidebar en móvil
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .page-content { padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
