@import url('./variables.css');

/* CSS Reset & Basic Layout */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  min-height: 100vh;
}

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden; /* Prevent full body scroll, handle within main */
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  background: var(--accent-color);
  color: white;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-style: italic;
  font-weight: bold;
}

.logo-text-wrapper {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.logo-subtext {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.15em;
  text-transform: lowercase;
  margin-top: 0.15rem;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
  flex: 1;
}

.nav-item {
  margin: 0.25rem 1rem;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  color: var(--text-sidebar);
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.2s, color 0.2s;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-item a:hover {
  background-color: var(--bg-hover);
  color: var(--text-sidebar-active);
}

.nav-item.active a {
  background-color: var(--bg-hover);
  color: var(--text-sidebar-active);
  border-left: 4px solid var(--accent-color);
  padding-left: calc(1rem - 4px); /* adjust padding for border */
}

.nav-icon {
  font-size: 1.1rem;
  opacity: 0.8;
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border-sidebar);
  padding-top: 1rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  cursor: pointer;
}

.user-profile:hover {
  background-color: var(--bg-hover);
}

.avatar {
  background-color: #e2e8f0;
  color: #1e293b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.avatar.small {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

.user-name {
  color: var(--text-sidebar-active);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Main Area Elements */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-color: var(--bg-primary);
}

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

/* Asset Breakdown Widget Hover States */
.asset-row {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.asset-row:hover {
    background-color: var(--bg-primary);
    transform: translateX(4px);
}
.topbar {
  display: flex;
  justify-content: flex-end; /* Align to right based on mockup */
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-search {
  display: flex;
  align-items: center;
  background-color: var(--bg-primary);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin-right: auto; /* Push search to the left if needed */
  border: 1px solid var(--border-color);
}

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  padding-left: 0.5rem;
  color: var(--text-primary);
  width: 250px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.icon-btn, .theme-toggle-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

#themeIcon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-left: 1px solid var(--border-color);
  padding-left: 1.5rem;
  cursor: pointer;
  position: relative;
}

.topbar-profile .user-name {
  color: var(--text-primary); /* Dark text for topbar */
}

/* Profile Dropdown Logic */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 15px);
  right: 0;
  width: 220px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 1000;
}

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

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

.dropdown-list li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.dropdown-list li a:hover {
  background-color: var(--bg-hover);
  color: var(--accent-color);
}

.dropdown-list li.logout-item {
  border-top: 1px solid var(--border-color);
  margin-top: 0.25rem;
  padding-top: 0.25rem;
}

.dropdown-list li.logout-item a:hover {
  color: #c0706f;
}

.dropdown-list svg {
  color: inherit;
}

/* Base Components */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 3rem;
  width: 100%;
}

.card {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

/* Typography Overrides */
h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 1.5rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-primary); }

a { color: var(--accent-color); text-decoration: none; }

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
