/* ================================================
   Control Impulso - CSS GLOBAL (solo layout y comunes)
   ================================================ */

:root {
    --coral: #FF6B6B;
    --coral-light: #FFE8E8;
    --coral-dark: #E85555;
    --electric-blue: #4ECDC4;
    --blue-dark: #2C9E96;
    --cream: #F7F5F3;
    --white: #FFFFFF;
    --charcoal: #2D3436;
    --gray-dark: #636E72;
    --gray-medium: #B2BEC3;
    --gray-light: #DFE6E9;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #E74C3C;
    --info: #3498DB;
    --gradient-warm: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    --gradient-cool: linear-gradient(135deg, #4ECDC4 0%, #44A3AA 100%);
    --shadow-soft: 0 10px 40px rgba(255, 107, 107, 0.15);
    --shadow-card: 0 20px 60px rgba(45, 52, 54, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--cream);
    color: var(--charcoal);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
}

.layout { display: flex; min-height: 100vh; }

/* ================================================
   SIDEBAR
   ================================================ */

.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--gray-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--charcoal);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-warm);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.2;
}

.logo-subtext {
    font-size: 0.7rem;
    color: var(--gray-dark);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-section { margin-bottom: 1rem; }

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-medium);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--gray-dark);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    margin-bottom: 0.125rem;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    font-family: 'Manrope', sans-serif;
}

.nav-item:hover, .nav-item.active {
    background: var(--coral-light);
    color: var(--coral);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.nav-badge {
    margin-left: auto;
    background: var(--coral);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-weight: 700;
}

.nav-badge.warning {
    background: var(--warning);
    color: var(--charcoal);
}

.nav-item.spd {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.1) 0%, rgba(78, 205, 196, 0.05) 100%);
    border: 1px solid rgba(78, 205, 196, 0.3);
    margin-top: 0.5rem;
}

.nav-item.spd:hover {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.2) 0%, rgba(78, 205, 196, 0.1) 100%);
    border-color: var(--electric-blue);
    color: var(--blue-dark);
}

.nav-item.spd i { color: var(--electric-blue); }

.external-icon {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--gray-medium);
}

/* ================================================
   USER DROPDOWN
   ================================================ */

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--gray-light);
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--cream);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    width: 100%;
    font-family: inherit;
    text-align: left;
}

.user-menu-btn:hover { background: var(--coral-light); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
    font-weight: 700;
    color: var(--charcoal);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-dark);
}

.user-menu-arrow {
    color: var(--gray-medium);
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.user-menu-btn.active .user-menu-arrow { transform: rotate(180deg); }

.user-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0.75rem;
    right: 0.75rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    border: 1px solid var(--gray-light);
    overflow: hidden;
    max-height: 70vh;
    overflow-y: auto;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--gray-dark);
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--cream);
    color: var(--coral);
}

.dropdown-item i { width: 18px; text-align: center; }

.dropdown-divider {
    height: 1px;
    background: var(--gray-light);
    margin: 0.25rem 0;
}

.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #fee; }

/* ================================================
   MAIN CONTENT - BÁSICO
   ================================================ */

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 1.5rem;
    min-height: 100vh;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.page-title p {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

/* ================================================
   COMPONENTES COMUNES BÁSICOS
   ================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-family: 'Manrope', sans-serif;
}

.btn-primary {
    background: var(--gradient-warm);
    color: white;
    box-shadow: var(--shadow-soft);
}

.btn-secondary {
    background: white;
    color: var(--charcoal);
    border: 2px solid var(--gray-light);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }

.card {
    background: var(--white);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 1.25rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-title { font-size: 1.1rem; color: var(--charcoal); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(78, 205, 196, 0.15); color: var(--electric-blue); }
.badge-warning { background: var(--coral-light); color: var(--coral); }
.badge-danger { background: #fee; color: var(--danger); }

.table-container { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
}

th {
    font-weight: 600;
    color: var(--gray-dark);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover { background: var(--cream); }

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1rem; }
}