/* ==========================================================================
   Voice AI Barni Carlo - Master Design System & Dashboard Stylesheet
   ========================================================================== */

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

:root {
  /* Color Tokens */
  --bg-dark: #07090e;
  --bg-primary: #0b0f19;
  --bg-card: rgba(16, 23, 38, 0.75);
  --bg-card-hover: rgba(22, 32, 54, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-input: rgba(10, 15, 26, 0.8);

  /* Accents & Brand Gradients */
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  
  --grad-primary: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --grad-surface: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
  --grad-glow: radial-gradient(circle at 50% 0%, rgba(0, 242, 254, 0.15), transparent 70%);

  /* Borders & Shadows */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 242, 254, 0.3);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 25px rgba(0, 242, 254, 0.2);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 242, 254, 0.06) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(79, 172, 254, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-success .badge-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-warning .badge-dot {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.badge-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.badge-danger .badge-dot {
  background: #f43f5e;
  box-shadow: 0 0 8px #f43f5e;
}

.badge-info {
  background: rgba(0, 242, 254, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
}
.badge-info .badge-dot {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* ==========================================================================
   Login View
   ========================================================================== */
#login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), 0 0 40px rgba(0, 242, 254, 0.1);
  position: relative;
  z-index: 10;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-logo-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 25px rgba(255, 255, 255, 0.15);
}

.brand-logo-img {
  max-width: 220px;
  height: auto;
  display: block;
}

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

.sidebar-logo-container {
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-logo-img {
  height: 28px;
  width: auto;
  display: block;
}

.sidebar-suite-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #050811;
  background: var(--grad-primary);
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s;
}

.input-field:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.15);
}

.btn-primary {
  width: 100%;
  padding: 12px 20px;
  background: var(--grad-primary);
  color: #050811;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.kb-sub-btn {
  border-radius: 20px;
  font-size: 0.85rem;
  padding: 6px 16px;
}

.kb-sub-btn.active {
  background: var(--grad-primary);
  color: #050811;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(0, 242, 254, 0.3);
}

.login-error-msg {
  color: var(--accent-rose);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
  display: none;
}

/* ==========================================================================
   Dashboard Main Layout
   ========================================================================== */
#dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #050811;
  font-weight: 800;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}

.sidebar-title span {
  color: var(--accent-cyan);
}

.nav-section-label {
  padding: 24px 24px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.nav-menu {
  list-style: none;
  padding: 0 12px;
  flex: 1;
}

.nav-item {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
  border-left: 3px solid var(--accent-cyan);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.15rem;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.user-meta-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-meta-role {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.btn-icon-logout {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-icon-logout:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.top-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(11, 15, 25, 0.6);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-title-area h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.header-status-strip {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Page Container */
.page-container {
  padding: 32px;
  flex: 1;
}

/* Tab Views */
.tab-view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   KPI Metrics Grid
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-cyan);
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.kpi-card.purple::before { background: var(--accent-purple); }
.kpi-card.emerald::before { background: var(--accent-emerald); }
.kpi-card.amber::before { background: var(--accent-amber); }

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--accent-cyan);
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.kpi-subtext {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Data Tables & Controls
   ========================================================================== */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  padding: 14px 18px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(11, 15, 25, 0.4);
}

.custom-table td {
  padding: 16px 18px;
  font-size: 0.88rem;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.table-action-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  transition: all 0.15s;
}

.table-action-btn:hover {
  background: rgba(0, 242, 254, 0.12);
  color: var(--accent-cyan);
  border-color: rgba(0, 242, 254, 0.3);
}

/* ==========================================================================
   Transcript & Detail Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-window {
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s;
}

.modal-close-btn:hover {
  color: #fff;
}

/* Transcript dialogue stream */
.dialogue-stream {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  position: relative;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: #e2e8f0;
  border-bottom-left-radius: 2px;
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(79, 172, 254, 0.15);
  border: 1px solid rgba(79, 172, 254, 0.3);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-author {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}

.chat-bubble.assistant .chat-author { color: var(--accent-cyan); }
.chat-bubble.user .chat-author { color: var(--accent-blue); }

.chat-time {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-align: right;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 72px;
  }
  .sidebar-title, .nav-text, .nav-section-label, .user-meta-name, .user-meta-role {
    display: none;
  }
  .sidebar-header {
    justify-content: center;
    padding: 0;
  }
  .nav-link {
    justify-content: center;
    padding: 12px 0;
  }
  .sidebar-footer {
    justify-content: center;
    padding: 12px 0;
  }
}
