/* ==========================================================================
   MAIN.CSS — Core Design System, Variables & Global Reset
   Dark Premium Theme with High Contrast, Modern Glass Touches, and Responsiveness
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette - Premium Dark Theme */
  --bg-darkest: #090b10;
  --bg-dark: #0f131c;
  --bg-card: #161c28;
  --bg-card-hover: #1e2637;
  --bg-glass: rgba(22, 28, 40, 0.85);
  --bg-glass-card: rgba(255, 255, 255, 0.03);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);

  /* Primary & Accent Gradients */
  --primary: #a855f7;
  --primary-hover: #9333ea;
  --primary-glow: rgba(168, 85, 247, 0.35);
  --accent-indigo: #6366f1;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  
  /* Status Colors */
  --status-online: #10b981;
  --status-offline: #6b7280;
  --status-busy: #f59e0b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  /* Elevation & Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px var(--primary-glow);
  
  /* Layout Dimensions */
  --header-height: 64px;
  --sidebar-width: 340px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-darkest);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Defaults */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.02em;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* App Shell Structure */
#app-shell {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 40%),
              var(--bg-darkest);
}

/* View Container System */
.view {
  width: 100%;
  height: 100%;
  display: none;
  position: relative;
}

.view.active {
  display: flex;
}

/* Main Dashboard View Layout */
.dashboard-layout {
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
}

/* Sidebar Navigation / Contact List */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-dark);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 10;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
}

/* Header Component */
.app-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 19, 28, 0.8);
  backdrop-filter: blur(12px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.app-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.app-logo-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.2;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.app-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  text-transform: uppercase;
}

/* Main Workspace Content Area */
.app-main {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-darkest);
  overflow: hidden;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Utility Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(99, 102, 241, 0.2); }
  50% { box-shadow: 0 0 24px rgba(99, 102, 241, 0.5); }
}

.animate-fade {
  animation: fadeIn var(--transition-normal) forwards;
}

/* Responsive Rules for Mobile */
@media (max-width: 768px) {
  .app-sidebar {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(0);
  }
  
  .dashboard-layout.chat-active .app-sidebar {
    transform: translateX(-100%);
  }

  .dashboard-layout.chat-active .app-main {
    display: flex;
    width: 100%;
  }
}
