/* ═══════════════════════════════════════════════════
   Rmetrics Compras Portal — estilos globales
   ═══════════════════════════════════════════════════ */

:root {
    --sidebar-width: 240px;
    --bg-dark: #0F172A;
    --bg-sidebar: #1E293B;
    --bg-page: #F1F5F9;
    --bg-card: #FFFFFF;
    --accent: #6366F1;
    --accent-light: #EEF2FF;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --info: #2563EB;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
}

/* ─── Layout ──────────────────────────────────────── */
.compras-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.content-area {
    padding: 32px;
    max-width: 1200px;
}

/* ─── Sidebar ─────────────────────────────────────── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 16px;
}

.brand-text {
    color: white;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #475569;
    padding: 4px 8px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #94A3B8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(255,255,255,.06);
    color: white;
}

.nav-item.active {
    background: var(--accent);
    color: white;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #E2E8F0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: #64748B;
}

.btn-logout {
    color: #64748B;
    padding: 6px;
    border-radius: 6px;
    text-decoration: none;
    transition: all .15s;
}

.btn-logout:hover { color: #F87171; background: rgba(248,113,113,.1); }

/* ─── Login ───────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 52px; height: 52px;
    background: var(--accent);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin-bottom: 12px;
}

/* ─── Cards ───────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: box-shadow .15s;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.info { color: var(--info); }

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-rmetrics {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-rmetrics .card-header-rm {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-rmetrics .card-header-rm h5 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-rmetrics .card-body-rm {
    padding: 0;
}

/* ─── Tabla ───────────────────────────────────────── */
.table-rm {
    width: 100%;
    border-collapse: collapse;
}

.table-rm th {
    background: #F8FAFC;
    border-bottom: 2px solid var(--border);
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    text-align: left;
}

.table-rm td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.table-rm tbody tr:hover { background: #F8FAFC; }
.table-rm tbody tr:last-child td { border-bottom: none; }

/* ─── Badges / Estado ─────────────────────────────── */
.badge-rm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-borrador { background: #F1F5F9; color: #64748B; }
.badge-publicada { background: #EFF6FF; color: #2563EB; }
.badge-pagada { background: #F0FDF4; color: #16A34A; }

/* ─── Botones ─────────────────────────────────────── */
.btn-accent {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s;
}

.btn-accent:hover { background: #4F46E5; color: white; }

.btn-outline-rm {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
}

.btn-outline-rm:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .15s;
}

.btn-ghost:hover { background: #F1F5F9; color: var(--text-primary); }
.btn-ghost.danger:hover { background: #FEF2F2; color: var(--danger); }

/* ─── Forms ───────────────────────────────────────── */
.form-rm label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: block;
}

.form-rm .form-control, .form-rm .form-select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    padding: 9px 12px;
    transition: border-color .15s;
}

.form-rm .form-control:focus, .form-rm .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ─── Page header ─────────────────────────────────── */
.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .content-area { padding: 16px; }
}

/* ─── Empty state ─────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 15px; }

/* ─── Alert ───────────────────────────────────────── */
.alert-rm {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.alert-rm.danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-rm.success { background: #F0FDF4; color: #14532D; border: 1px solid #BBF7D0; }
.alert-rm.info { background: #EFF6FF; color: #1E3A5F; border: 1px solid #BFDBFE; }

/* ─── Suscripción icons (nuevas categorías) ──── */
.icon-dev   { background: linear-gradient(135deg, #10B981, #059669); }
.icon-ses   { background: linear-gradient(135deg, #F59E0B, #D97706); }
.icon-dom   { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
.icon-dev-mini  { background: linear-gradient(135deg, #10B981, #059669); }
.icon-ses-mini  { background: linear-gradient(135deg, #F59E0B, #D97706); }
.icon-dom-mini  { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
