/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-right: 1px solid var(--border-color);
    z-index: 1050;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    min-height: var(--header-height);
    gap: 12px;
}

.sidebar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.sidebar-brand .brand-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    transition: var(--transition);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .badge {
    display: none;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 20px 20px 8px;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.nav-item {
    padding: 0 10px;
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: var(--transition);
    gap: 12px;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-link.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link .badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 3px 7px;
    border-radius: 10px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ============================================
   HEADER
   ============================================ */
.top-header {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-sidebar-toggle:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.service-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.notification-bell {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.notification-bell:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.notification-bell .badge-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--accent-light);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.user-info .user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-info .user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.role-badge {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.admin { background: rgba(230, 57, 70, 0.2); color: var(--danger); }
.role-badge.operador { background: var(--accent-light); color: var(--accent); }

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
    flex: 1;
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   FOOTER
   ============================================ */
.main-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 12px 24px;
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================
   NOTIFICATION DROPDOWN
   ============================================ */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1060;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown.show { display: block; }

.notification-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.85rem;
}

.notification-dropdown-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.notification-dropdown-item:hover {
    background: var(--accent-light);
}

.notification-dropdown-item.unread {
    border-left: 3px solid var(--accent);
}

.notification-dropdown-item .notif-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.notification-dropdown-item .notif-time {
    font-size: 0.68rem;
    color: var(--text-muted);
}
