:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #1e40af;
    --background-color: #f3f4f6;
    --sidebar-bg: #1f2937;
    --sidebar-text: #e5e7eb;
    --header-bg: #ffffff;
    --text-color: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --font-family: 'Inter', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    overflow: hidden;
}

/* ========================================
   TOPBAR STYLES
   ======================================== */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
    background: var(--header-bg);
}

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

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-logo {
    height: 32px;
    width: auto;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 8px;
}

.topbar-module-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.topbar-module-title i {
    color: var(--primary-color);
}

.topbar-center {
    display: flex;
    align-items: center;
}

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

/* Toggle Sidebar Button */
.toggle-sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.toggle-sidebar-btn:hover {
    background-color: var(--background-color);
    color: var(--text-color);
}

/* ========================================
   USER MENU STYLES
   ======================================== */

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-menu-btn:hover {
    background-color: var(--background-color);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    color: white;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-btn i:last-child {
    font-size: 10px;
    color: var(--text-muted);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    display: block;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.user-dropdown-item:hover {
    background-color: #f8fafc;
}

.user-dropdown-item.logout {
    color: #dc2626;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.user-dropdown-item.logout:hover {
    background-color: #fef2f2;
}

.user-dropdown-item i {
    width: 16px;
    text-align: center;
}

.user-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

/* ========================================
   DASHBOARD STYLES
   ======================================== */

.dashboard-container {
    padding: 8px;
}

.welcome-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.welcome-card h1 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
}

.welcome-card p {
    margin: 0;
    opacity: 0.9;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--header-bg);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: #eff6ff;
    border-radius: var(--radius-md);
    color: var(--primary-color);
    font-size: 20px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================
   PLACEHOLDER STYLES
   ======================================== */

.placeholder-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.placeholder-container h2 {
    margin: 0 0 8px 0;
    color: var(--text-color);
}

.placeholder-container p {
    margin: 0;
}

/* ========================================
   W2UI OVERRIDES
   ======================================== */

.w2ui-layout {
    font-family: var(--font-family) !important;
}

.w2ui-sidebar .w2ui-node-text {
    font-family: var(--font-family);
}

/* Sidebar tree styles - módulos como grupos */
.w2ui-sidebar .w2ui-node-group {
    font-weight: 600 !important;
    color: var(--text-color) !important;
}

.w2ui-sidebar .w2ui-node-group > .w2ui-node-data {
    background-color: #f1f5f9 !important;
    border-bottom: 1px solid var(--border-color);
}

.w2ui-sidebar .w2ui-node-sub {
    background-color: transparent;
}

.w2ui-grid .w2ui-record table {
    font-family: var(--font-family);
}

/* Custom Login Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.login-box {
    width: 400px;
    height: 350px !important;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
}

.w2ui-form-header {
    background-color: var(--primary-color) !important;
    color: white !important;
    font-weight: 600 !important;
    text-align: center;
    padding: 15px !important;
    border-bottom: none !important;
    font-size: 1.1rem !important;
}

.w2ui-buttons {
    background-color: #f9fafb !important;
    border-top: 1px solid var(--border-color) !important;
}

.w2ui-btn {
    border-radius: var(--radius-sm) !important;
    font-weight: 500 !important;
}

.w2ui-btn-blue {
    background-color: var(--primary-color) !important;
    border: 1px solid var(--secondary-color) !important;
}

/* ========================================
   W2UI PANEL OVERRIDES
   ======================================== */

/* Permitir overflow para menú de usuario */
.w2ui-panel-top,
.w2ui-panel-top > div,
.w2ui-panel-top .w2ui-panel-content,
.w2ui-panel-top .w2ui-panel-content > div,
#layout_mainLayout_panel_top,
#layout_mainLayout_panel_top > div {
    overflow: visible !important;
}

.topbar,
.topbar-right,
.user-menu {
    overflow: visible !important;
}

.user-dropdown {
    z-index: 99999 !important;
}