/* Dashboard Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  --primary-color: #0F172A; 
  --secondary-color: #06B6D4; 
  --secondary-glow: rgba(6, 182, 212, 0.4);
  --accent-color: #38BDF8; 
  --bg-color: #020617; /* Deeper background */
  --sidebar-bg: #0F172A; 
  --card-bg: rgba(30, 41, 59, 0.4);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-light: #F8FAFC;
  --text-muted: #94A3B8;
  --transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --page-padding: 3rem;
  --card-gap: 2.5rem;
  --radius-lg: 32px;
  --radius-md: 20px;
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-blur: 8px;
}

/* Theme Selector Tiles */
.theme-tile {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.1);
    transition: var(--transition);
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.theme-tile:hover { transform: scale(1.2) translateY(-2px); border-color: white; }
.theme-tile.cian { background: #06B6D4; }
.theme-tile.green { background: #22C55E; }
.theme-tile.amber { background: #EAB308; }
.theme-tile.purple { background: #A855F7; }
.theme-tile.rose { background: #F43F5E; }

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-light);
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* Fix para listas desplegables (select) en Chrome/Windows */
select { color-scheme: dark; }
select option {
  background-color: #1e293b !important;
  color: #ffffff !important;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, #0F172A 0%, #020617 100%);
  border-right: 1px solid rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 50;
  box-shadow: 10px 0 30px rgba(0,0,0,0.5);
}

/* Mobile Toggle Toggle */
.menu-toggle {
    display: none;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: white;
    transition: var(--transition);
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--secondary-color);
}

/* Overlay for mobile menu */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar-header {
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.sidebar-header img {
  height: 40px;
  filter: drop-shadow(0 0 10px var(--secondary-glow));
}

.sidebar-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
  letter-spacing: 2px;
}

.sidebar-header h2 span {
  color: var(--secondary-color);
}

.sidebar-menu {
  flex: 1;
  padding: 1.5rem 0;
  list-style: none;
  overflow-y: auto;
}

/* Custom Scrollbar for Sidebar Menu */
.sidebar-menu::-webkit-scrollbar {
  width: 6px;
}
.sidebar-menu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

.sidebar-menu li {
  padding: 0.2rem 1rem;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0.8rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: var(--transition);
  font-weight: 500;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
  background: rgba(6, 182, 212, 0.1);
  color: white;
}

.sidebar-menu a i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-menu a.active i {
  color: var(--secondary-color);
}

/* Submenu Labels */
.sidebar-label {
  padding: 0.5rem 1rem 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  opacity: 0.7;
}

/* Coming Soon Badges */
.sidebar-menu a {
  position: relative;
}

.badge-soon {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(245,158,11,0.15);
  color: #F59E0B;
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 20px;
  padding: 0.15rem 0.5rem;
  text-transform: uppercase;
}

.dashboard-body {
  flex: 1;
  padding: var(--page-padding);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.page-title {
  margin-bottom: 3.5rem;
  text-align: center; /* Center titles globally for premium feel */
}

.page-title h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 3rem; /* Larger titles */
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, var(--secondary-color) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}

.page-title p {
  color: var(--text-muted);
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto;
}

.sidebar-menu a[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--card-gap);
  margin-bottom: var(--card-gap);
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.8rem;
  transition: var(--transition);
  backdrop-filter: blur(var(--glass-blur));
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.03));
  pointer-events: none;
}

.stat-card:hover {
  border-color: var(--secondary-glow);
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 20px var(--secondary-glow);
  background: rgba(30, 41, 59, 0.5);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.cyan   { background: rgba(6,182,212,0.15);  color: #06B6D4; }
.stat-icon.green  { background: rgba(34,197,94,0.15);   color: #22C55E; }
.stat-icon.amber  { background: rgba(245,158,11,0.15);  color: #F59E0B; }
.stat-icon.purple { background: rgba(167,139,250,0.15); color: #A78BFA; }

.stat-info { flex: 1; }

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
}

.stat-badge.up   { background: rgba(34,197,94,0.15);  color: #22C55E; }
.stat-badge.down { background: rgba(239,68,68,0.15);  color: #EF4444; }

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(30,41,59,0.97);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-light);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
  min-width: 280px;
  max-width: 360px;
}

.toast i { font-size: 1.1rem; flex-shrink: 0; }
.toast.success { border-left: 3px solid #22C55E; }
.toast.success i { color: #22C55E; }
.toast.error   { border-left: 3px solid #EF4444; }
.toast.error i { color: #EF4444; }
.toast.info    { border-left: 3px solid #06B6D4; }
.toast.info i  { color: #06B6D4; }

/* ── Extras & Widgets ── */
.widgets-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.widget-card {
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 20px;
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.widget-card:hover {
  border-color: rgba(6, 182, 212, 0.2);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Hidratación */
.hydration-content {
  text-align: center;
  padding: 1rem 0;
}

.water-glass-container {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #38BDF8;
  filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.4));
  animation: float 3s ease-in-out infinite;
}

.hydration-counter {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: white;
}

.hydration-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.hydration-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn-water {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-water:hover {
  background: var(--secondary-color);
  border-color: var(--secondary-color);
  transform: scale(1.1);
}

.btn-water.minus:hover {
  background: #EF4444;
  border-color: #EF4444;
}

/* Clima */
.weather-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.weather-temp {
  font-family: 'Outfit', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  color: white;
}

.weather-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: capitalize;
}

.weather-icon {
  font-size: 3.5rem;
  color: #FBBF24;
  filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.4));
}

/* Quote */
.quote-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(15, 23, 42, 0.5));
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.quote-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.quote-author {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(120%); }
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.btn-logout {
  width: 100%;
  padding: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

/* ── Notificaciones ── */
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  background: #EF4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary-color);
  animation: pulse-notif 2s infinite;
}

@keyframes pulse-notif {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.notif-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 15px;
  margin-top: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: none;
  z-index: 1000;
}

@media (max-width: 768px) {
  .notif-dropdown {
    position: fixed;
    top: 70px;
    left: 10px;
    right: 10px;
    width: auto;
    margin-top: 5px;
  }
}

.notif-dropdown.show { display: block; animation: slideDown 0.3s ease; }

.notif-header {
  padding: 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-header h3 { font-size: 1rem; margin: 0; color: white; }

.notif-list {
  max-height: 350px;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  list-style: none;
}

.notif-item {
  padding: 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: var(--transition);
}

.notif-item:hover { background: rgba(255,255,255,0.03); }
.notif-item.unread { background: rgba(6, 182, 212, 0.05); border-left: 3px solid var(--secondary-color); }

.notif-title { font-weight: 700; font-size: 0.9rem; color: white; margin-bottom: 4px; }
.notif-msg { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.notif-time { font-size: 0.7rem; color: var(--secondary-color); margin-top: 8px; opacity: 0.7; }
.notif-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* ── Finanzas ── */
.finance-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1.5rem;
}

.finance-card {
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 20px;
  padding: 1.5rem;
  transition: var(--transition);
}

.finance-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.1); }

.fin-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.fin-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: white;
}

.fin-footer {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--secondary-color);
  opacity: 0.8;
}

.finance-card.main-balance { border-left: 4px solid var(--secondary-color); background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), var(--card-bg)); }
.finance-card.income .fin-header i { color: #22C55E; }
.finance-card.expense .fin-header i { color: #EF4444; }

@media (max-width: 1024px) {
  .finance-grid { grid-template-columns: 1fr; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-logout:hover {
  background: #EF4444;
  color: white;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.top-header {
  height: 70px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  position: sticky;
  top: 0;
  z-index: 5000;
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--sidebar-bg);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  width: 300px;
}

.header-search i {
  color: var(--text-muted);
  margin-right: 10px;
}

.header-search input {
  background: transparent;
  border: none;
  color: white;
  width: 100%;
  outline: none;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 12px;
  transition: var(--transition);
}

.header-user:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  color: white;
  border: 2px solid white;
}

/* Profile Dropdown Styles */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 15px);
  right: 0;
  width: 240px;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  z-index: 6000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.profile-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 17px;
  width: 12px;
  height: 12px;
  background: rgba(30, 41, 59, 0.95);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transform: rotate(45deg);
}

.profile-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.dropdown-header span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.dropdown-menu-list {
  padding: 0.5rem;
  list-style: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-light);
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.dropdown-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  color: var(--secondary-color);
}

.dropdown-item:hover {
  background: rgba(6, 182, 212, 0.1);
  color: white;
}

.dropdown-item.logout {
  color: #EF4444;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
}

.dropdown-item.logout i {
  color: #EF4444;
}

.dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

/* ── Enhanced Dropdown Items ── */
.dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdown-user-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #06B6D4, #38BDF8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dd-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.dd-icon.cyan   { background: rgba(6,182,212,0.15);   color: #06B6D4; }
.dd-icon.green  { background: rgba(34,197,94,0.15);    color: #22C55E; }
.dd-icon.amber  { background: rgba(245,158,11,0.15);   color: #F59E0B; }
.dd-icon.purple { background: rgba(167,139,250,0.15);  color: #A78BFA; }
.dd-icon.muted  { background: rgba(148,163,184,0.12);  color: #94A3B8; }
.dd-icon.danger { background: rgba(239,68,68,0.12);    color: #EF4444; }

.dd-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.dd-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  line-height: 1.2;
}

.dd-sub {
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 1px;
}

.dropdown-item:hover .dd-icon.cyan   { background: rgba(6,182,212,0.28);  }
.dropdown-item:hover .dd-icon.green  { background: rgba(34,197,94,0.28);  }
.dropdown-item:hover .dd-icon.amber  { background: rgba(245,158,11,0.28); }
.dropdown-item:hover .dd-icon.purple { background: rgba(167,139,250,0.28);}
.dropdown-item:hover .dd-icon.muted  { background: rgba(148,163,184,0.22);}
.dropdown-item:hover .dd-icon.danger { background: rgba(239,68,68,0.22);  }

/* Theme Selector Tiles */
.theme-tile {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s;
}
.theme-tile:hover { transform: scale(1.1); }
.theme-tile.cian   { background: #06B6D4; }
.theme-tile.green  { background: #22C55E; }
.theme-tile.amber  { background: #F59E0B; }
.theme-tile.purple { background: #A78BFA; }
.theme-tile.rose   { background: #F43F5E; }

/* Override logout item to use new structure */
.dropdown-item.logout { border-top: 1px solid rgba(255,255,255,0.05); }
.dropdown-item.logout .dd-name { color: #EF4444; }
.dropdown-item.logout:hover { background: rgba(239,68,68,0.06); }

/* Wider dropdown to fit new layout */
.profile-dropdown { width: 270px; }

.dashboard-body {
  padding: 2rem;
  flex: 1;
  overflow-y: auto;
}

.page-title {
  margin-bottom: 2rem;
}

.page-title h1 {
  font-size: 1.8rem;
  color: white;
  margin-bottom: 0.2rem;
}

.page-title p {
  color: var(--text-muted);
}

/* User Profile Card */
.profile-card {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.05);
  padding: 2rem;
  display: flex;
  gap: 2rem;
  align-items: center;
  max-width: 800px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}

/* Glassmorphism subtle glow */
.profile-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  background: var(--secondary-color);
  filter: blur(80px);
  opacity: 0.2;
  z-index: 0;
}

.profile-avatar-large {
  position: relative;
  z-index: 1;
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 3rem;
  color: white;
  border: 4px solid var(--sidebar-bg);
  box-shadow: 0 5px 15px rgba(6, 182, 212, 0.3);
}

.profile-info {
  position: relative;
  z-index: 1;
  flex: 1;
}

.profile-info h2 {
  font-size: 1.8rem;
  color: white;
  margin-bottom: 0.5rem;
}

.profile-info .role-badge {
  display: inline-block;
  background: rgba(6, 182, 212, 0.2);
  color: var(--secondary-color);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.profile-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  color: white;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-value i {
  color: var(--secondary-color);
}

/* --- MODALES PRO --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 90%;
  max-width: 500px;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s;
}

.close-modal:hover {
  color: white;
}

/* History List inside Modal */
.history-list {
  max-height: 250px;
  overflow-y: auto;
  margin-top: 1.5rem;
  padding-right: 5px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
  border-radius: 10px;
  border-left: 4px solid #ccc;
}

.history-item.ingreso { border-left-color: #22C55E; }
.history-item.egreso { border-left-color: #EF4444; }

.history-info .h-desc { font-weight: 600; font-size: 0.95rem; }
.history-info .h-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.history-amount { font-weight: 700; font-family: 'Outfit', sans-serif; }
.history-amount.ingreso { color: #22C55E; }
.history-amount.egreso { color: #EF4444; }

/* Custom Form Styles for Modal */
.modal-form .form-group { margin-bottom: 1rem; }
.modal-form label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.modal-form select, .modal-form input {
  width: 100%;
  padding: 0.8rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: white;
  outline: none;
}

.modal-form select:focus, .modal-form input:focus {
  border-color: var(--secondary-color);
}

.btn-action {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--secondary-color);
  color: white;
  margin-top: 1rem;
}

.btn-action:hover {
  filter: brightness(1.2);
  transform: translateY(-2px);
}

/* Clickable Stats Cards */
.stat-card.interactive {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stat-card.interactive::after {
  content: '\f067';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.3s;
}

.stat-card.interactive:hover::after {
  opacity: 1;
}

.stat-card.interactive:hover {
  transform: translateY(-5px);
  border-color: rgba(255,255,255,0.2);
}

/* --- CHARTS ANALYTICS --- */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-period {
  font-size: 0.75rem;
  color: var(--secondary-color);
  background: rgba(6, 182, 212, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.chart-body {
  position: relative;
  height: 280px;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-body {
    height: 240px;
  }
}

/* --- PROFILE BANNER --- */
.profile-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(15, 23, 42, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 3rem;
  margin-bottom: var(--card-gap);
  display: flex;
  align-items: center;
  gap: 3rem;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 100%;
  height: 200%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
  z-index: -1;
}

.profile-avatar-large {
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 800;
  color: white;
  box-shadow: 0 0 40px rgba(6, 182, 212, 0.3);
  flex-shrink: 0;
  border: 4px solid rgba(255, 255, 255, 0.1);
}

.profile-info {
  flex: 1;
}

.profile-info h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.role-badge {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  background: rgba(6, 182, 212, 0.1);
  color: var(--secondary-color);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2rem;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.profile-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.detail-value {
  font-size: 1rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-form select:focus, .modal-form input:focus {
  border-color: var(--secondary-color);
}

.btn-action {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--secondary-color);
  color: white;
  margin-top: 1rem;
}

.btn-action:hover {
  filter: brightness(1.2);
  transform: translateY(-2px);
}

/* Clickable Stats Cards */
.stat-card.interactive {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stat-card.interactive::after {
  content: '\f067';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.3s;
}

.stat-card.interactive:hover::after {
  opacity: 1;
}

.stat-card.interactive:hover {
  transform: translateY(-5px);
  border-color: rgba(255,255,255,0.2);
}

/* --- CHARTS ANALYTICS --- */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-period {
  font-size: 0.75rem;
  color: var(--secondary-color);
  background: rgba(6, 182, 212, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.chart-body {
  position: relative;
  height: 280px;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-body {
    height: 240px;
  }
}

/* --- PROFILE BANNER --- */
.profile-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(15, 23, 42, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 3rem;
  margin-bottom: var(--card-gap);
  display: flex;
  align-items: center;
  gap: 3rem;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 100%;
  height: 200%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
  z-index: -1;
}

.profile-avatar-large {
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 800;
  color: white;
  box-shadow: 0 0 40px rgba(6, 182, 212, 0.3);
  flex-shrink: 0;
  border: 4px solid rgba(255, 255, 255, 0.1);
}

.profile-info {
  flex: 1;
}

.profile-info h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.role-badge {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  background: rgba(6, 182, 212, 0.1);
  color: var(--secondary-color);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2rem;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.profile-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.detail-value {
  font-size: 1rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-value i {
  color: var(--secondary-color);
  font-size: 1.1rem;
}

/* --- RESPONSIVENESS OVERHAUL --- */
@media (max-width: 1150px) { /* Increased from 1024px to prevent distortion on medium screens */
  :root {
    --page-padding: 1.5rem;
    --card-gap: 1.5rem;
  }
  
  .sidebar {
    width: 80px;
    padding: 1rem 0;
  }
  
  .sidebar-header img {
    margin-right: 0;
  }

  .sidebar-header h2, 
  .sidebar-menu a span,
  .sidebar-separator,
  .btn-logout span {
    display: none !important;
  }
  
  .sidebar-menu a {
    justify-content: center;
    padding: 1.2rem;
    font-size: 1.4rem;
  }

  .sidebar-menu a i {
    margin: 0;
  }

  .sidebar-footer {
    padding: 1rem;
    text-align: center;
  }

  .btn-logout {
    width: 50px;
    height: 50px;
    padding: 0;
    justify-content: center;
    margin: 0 auto;
  }
  
  .main-content {
    margin-left: 80px;
    width: calc(100% - 80px);
  }

  /* TOOLTIPS for collapsed menu icons */
  .sidebar-menu a:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 85px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 9000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
  }

  .profile-card {
    padding: 2rem;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  :root {
    --page-padding: 1.2rem;
  }

  body {
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px; /* Hide off-screen */
    width: 280px;
    height: 100vh;
    z-index: 7000;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    background: var(--sidebar-bg);
  }

  .sidebar.open {
    transform: translateX(280px);
  }

  .sidebar-header {
      padding: 2rem 1.5rem;
  }

  .sidebar-menu {
      padding: 1rem;
  }

  .sidebar-footer {
    display: block;
    margin-top: auto;
    padding: 1.5rem;
  }

  .main-content {
      width: 100%;
      margin-left: 0;
      height: auto;
      min-height: 100vh;
      overflow-x: hidden;
  }

  .top-header {
      padding: 0.8rem 1rem;
      z-index: 5000;
      display: grid;
      grid-template-columns: 50px 1fr 50px;
      align-items: center;
      text-align: center;
  }

  .menu-toggle {
      display: flex;
      justify-content: flex-start;
      font-size: 1.4rem;
  }

  .header-search {
      display: none;
  }

  .header-user {
      padding: 0;
      justify-content: flex-end;
  }

  .header-actions {
      display: none !important; /* Hide search/notif in mobile header to avoid clutter, or reposition */
  }

  .header-user > div:first-child {
      display: none;
  }

  .profile-dropdown {
      width: calc(100vw - 40px);
      max-width: 300px;
      right: -10px;
      top: 60px;
      z-index: 6000;
      background: rgba(15, 23, 42, 0.98);
      backdrop-filter: blur(20px);
      border: 1px solid rgba(6, 182, 212, 0.3);
  }

  /* Centered logo for mobile */
  .top-header::after {
      content: 'HIKARIAPP';
      grid-column: 2;
      font-weight: 800;
      letter-spacing: 2px;
      font-size: 1.1rem;
      color: white;
      font-family: 'Outfit', sans-serif;
  }
  .top-header::after span { color: var(--secondary-color); }

  .profile-dropdown::before {
      right: 25px;
  }

  .profile-card {
    flex-direction: column;
    text-align: center;
    padding: 2.5rem 1.5rem;
  }
  
  .profile-avatar-large {
    width: 100px;
    height: 100px;
    font-size: 2.5rem;
    margin: 0 auto;
  }
  
  .profile-details {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  
  .detail-item {
    align-items: center;
  }
  
  .page-title h1 {
    font-size: 1.8rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat-card {
    padding: 1.5rem;
  }
}

/* --- Profile Dropdown Icons Fix --- */
.profile-dropdown .dropdown-item i,
.profile-dropdown .dd-icon i {
    color: var(--secondary-color) !important;
    font-size: 1.1rem !important;
    width: 24px;
    text-align: center;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    visibility: visible !important;
}

.profile-dropdown .dropdown-item:hover i,
.profile-dropdown .dropdown-item:hover .dd-icon i {
    color: var(--accent-color) !important;
    transform: scale(1.15);
}


/* App Drawer Visual Menu - FIXED */
.app-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.app-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.app-drawer-content {
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    background: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-drawer-overlay.active .app-drawer-content {
    transform: scale(1);
}

.app-drawer-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    z-index: 10;
}

.app-drawer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding: 1rem 0.5rem;
    flex: 1;
}

.app-drawer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 1.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    text-decoration: none;
    transition: 0.2s;
}

.app-drawer-item:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--secondary-color);
    transform: translateY(-3px);
}

.app-drawer-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.app-drawer-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: white !important;
    text-align: center;
}

/* Volver al Inicio */
.btn-back-home {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    background: var(--secondary-color);
    color: white !important;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    z-index: 9000;
    text-decoration: none;
    transition: 0.3s;
}

@media (max-width: 480px) {
    .app-drawer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .app-drawer-content {
        padding: 1.5rem 1rem;
    }
}

