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

/* ==========================================================================
   CSS Reset & Base Rules
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-family-main);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-card-secondary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-medium);
}

/* Monospace numeric helpers */
.font-mono {
  font-family: var(--font-family-mono);
  font-feature-settings: "tnum" 1, "zero" 1;
}

.text-up {
  color: var(--color-up) !important;
}
.text-down {
  color: var(--color-down) !important;
}
.text-purple {
  color: var(--accent-purple) !important;
}
.text-yellow {
  color: var(--binance-yellow) !important;
}
.text-muted {
  color: var(--text-secondary) !important;
}

/* Flash Animations on Price Tick */
@keyframes flashUp {
  0% { background-color: var(--color-up-flash); color: #fff; }
  100% { background-color: transparent; }
}

@keyframes flashDown {
  0% { background-color: var(--color-down-flash); color: #fff; }
  100% { background-color: transparent; }
}

.flash-up {
  animation: flashUp 0.6s ease-out;
}
.flash-down {
  animation: flashDown 0.6s ease-out;
}

/* ==========================================================================
   App Shell Grid Layout
   ========================================================================== */
#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-app);
  overflow: hidden;
}

/* ==========================================================================
   Left Navigation Sidebar (Exact SistemasPronto Aesthetic)
   ========================================================================== */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar-brand-box {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-text-main {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #FFFFFF;
}

.brand-text-accent {
  font-size: 19px;
  font-weight: 800;
  color: #EF4444; /* Red accent from SistemasPronto */
}

/* Sidebar Navigation Items */
.sidebar-nav-container {
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-category-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  padding: 10px 12px 6px 12px;
}

.nav-item-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.nav-item-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.nav-item-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.nav-item-btn.active {
  color: #FFFFFF;
  background-color: var(--bg-active-pill);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

/* Sidebar Sub-Menu (Negociação Própria) */
.nav-group-wrapper {
  display: flex;
  flex-direction: column;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-group-header:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.nav-group-header.open {
  color: var(--text-primary);
}

.nav-sub-list {
  display: flex;
  flex-direction: column;
  padding-left: 20px;
  margin-top: 2px;
  gap: 2px;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.nav-sub-item:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.nav-sub-item.active {
  color: #FFFFFF;
  background-color: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-weight: 600;
}

.nav-sub-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--text-tertiary);
}

.nav-sub-item.active .nav-sub-dot {
  background-color: var(--accent-purple);
  box-shadow: 0 0 6px var(--accent-purple);
}

/* Sidebar User Card on Bottom */
.sidebar-user-footer {
  padding: 14px;
  border-top: 1px solid var(--border-subtle);
  background-color: rgba(14, 19, 34, 0.7);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.user-avatar-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.user-card-meta {
  display: flex;
  flex-direction: column;
}

.user-card-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #FFFFFF;
}

.user-card-role {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ==========================================================================
   Main App Content Area
   ========================================================================== */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-app);
}

/* Topbar Header matching Screenshots */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 50;
  flex-shrink: 0;
}

.topbar-page-info {
  display: flex;
  flex-direction: column;
}

.topbar-page-title {
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.3px;
}

.topbar-page-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Topbar Telemetry Clocks & User Menu */
.topbar-right-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.server-clock-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 11.5px;
}

.clock-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.clock-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-purple);
  text-transform: uppercase;
}

.clock-time {
  font-family: var(--font-family-mono);
  font-weight: 700;
  color: #FFFFFF;
}

.clock-divider {
  width: 1px;
  height: 12px;
  background-color: var(--border-subtle);
}

.topbar-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.topbar-pill-btn:hover {
  border-color: var(--border-medium);
  background-color: var(--bg-hover);
}

.notification-bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.notification-bell-btn:hover {
  color: #fff;
  border-color: var(--border-medium);
}

.bell-badge-count {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #EF4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-sidebar);
}

.topbar-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Views Router Container (100% Full Height Optimization)
   ========================================================================== */
.view-container {
  flex: 1;
  display: none;
  min-height: 0;
  width: 100%;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

.view-container.active {
  display: flex;
}

/* Trading room fills 100% height without body scroll */
#view-trading-room.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

/* Dashboard with topbar header */
#view-dashboard.active {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100vh;
}
