/* Dashboard Core CSS */
:root {
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --brand-red: #ba2025;
  --brand-red-light: #d32f2f;
  --brand-red-glow: rgba(186, 32, 37, 0.15);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --accent-emerald: #059669;
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --sidebar-width: 280px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow: hidden; /* Prevent full body scroll, handle scroll in content area */
}

h1, h2, h3, h4, .brand-font {
  font-family: 'Outfit', sans-serif;
}

/* Auth Overlay */
.auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-modal {
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 40px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  text-align: center;
}

.auth-google-btn {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--border-dark);
  border-radius: 30px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  margin-top: 24px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.auth-google-btn:hover {
  border-color: #4285F4;
  background: #f8fafc;
  transform: translateY(-1px);
}

.auth-status-msg {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--brand-red);
  font-weight: 600;
}

/* Application Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: width 0.3s ease, transform 0.3s ease;
}

/* Collapsed Sidebar (Icon-Only Mode) */
.sidebar.collapsed {
  width: 70px !important;
}

.sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

.sidebar.collapsed .logo-container {
  padding: 0;
  justify-content: center;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .menu-section-title,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .sidebar-footer {
  display: none !important;
}

.sidebar.collapsed .menu-item {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .menu-item svg {
  margin-right: 0;
}

.sidebar-toggle-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar.collapsed .sidebar-toggle-row {
  justify-content: center;
  padding: 8px 0;
}

#sidebarToggleBtn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

#sidebarToggleBtn:hover {
  background: var(--bg-main);
  color: var(--brand-red);
}

.sidebar-header {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  gap: 12px;
}

.logo-container { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-main-sign { width: 36px; height: 36px; display: block; object-fit: contain; }
.logo-brand-block { display: flex; flex-direction: column; justify-content: center; }
.logo-wordmark { height: 22px; width: auto; display: block; object-fit: contain; }
.logo-subtext {
  font-size: 0.60rem; font-weight: 700; color: var(--brand-red);
  letter-spacing: 1.1px; text-transform: none; margin-top: 1px;
}
  color: var(--text-main);
  line-height: 1;
}

.sidebar-brand-text .subname {
  font-size: 0.65rem;
  color: var(--brand-red);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-menu {
  flex: 1;
  padding: 24px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 16px 0 8px 12px;
}

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

.menu-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: stroke 0.2s ease, fill 0.2s ease;
}

.menu-item:hover {
  background: rgba(241, 245, 249, 0.8);
  color: var(--text-main);
}

.menu-item.active {
  background: rgba(186, 32, 37, 0.08);
  color: var(--brand-red);
  font-weight: 600;
}

/* Make icons match active state */
.menu-item.active svg {
  stroke: var(--brand-red);
}
.menu-item.active svg.fill-icon {
  fill: var(--brand-red);
  stroke: none;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-main);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-email {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--brand-red);
  font-weight: 600;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(0,0,0,0.05);
  color: var(--brand-red);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 72px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 5;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.tenant-badge {
  background: rgba(186, 32, 37, 0.08);
  color: var(--brand-red);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(186, 32, 37, 0.2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-switch {
  display: flex;
  background: var(--bg-main);
  border-radius: 20px;
  padding: 4px;
  border: 1px solid var(--border);
}

.lang-btn {
  background: transparent;
  border: none;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.content-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* Card Boxes */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon.red { background: rgba(186, 32, 37, 0.1); color: var(--brand-red); }
.card-icon.blue { background: rgba(37, 99, 235, 0.1); color: var(--accent-blue); }
.card-icon.emerald { background: rgba(5, 150, 105, 0.1); color: var(--accent-emerald); }
.card-icon.purple { background: rgba(124, 58, 237, 0.1); color: var(--accent-purple); }

.card-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  margin-bottom: 4px;
}

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

/* Wide panel */
.panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
  margin-bottom: 32px;
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(248, 250, 252, 0.5);
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.panel-body {
  padding: 24px;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(248, 250, 252, 0.8);
}

.data-table td {
  font-size: 0.95rem;
  color: var(--text-main);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  background: rgba(241, 245, 249, 1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-icon svg {
  width: 32px; height: 32px;
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-desc {
  color: var(--text-muted);
  max-width: 400px;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* Buttons */
.btn-primary {
  background: var(--brand-red);
  color: white;
  border: 1px solid transparent;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--brand-red-light);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: var(--text-main);
  border: 1px solid var(--border-dark);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-main);
  border-color: var(--text-muted);
}

/* Voice Recorder UI */
.voice-recorder-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(241, 245, 249, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.btn-record {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-record:hover {
  background: #ef4444;
  color: white;
}

.btn-record.recording {
  animation: pulse 1.5s infinite;
  background: #ef4444;
  color: white;
}

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

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    height: 100vh;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .topbar {
    padding: 0 16px;
  }
  .content-scrollable {
    padding: 20px 16px;
  }
}

/* Toast Notifications */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: white;
  border-left: 4px solid var(--brand-red);
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.4;
}

.toast.success {
  border-left-color: var(--accent-emerald);
}

.toast.error {
  border-left-color: var(--brand-red);
}

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

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

/* Tooltips */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-alt, #f1f5f9);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  margin-left: 6px;
  position: relative;
  border: 1px solid var(--border);
}
.tooltip-icon:hover {
  background: var(--brand-red);
  color: white;
  border-color: var(--brand-red);
}
.tooltip-box {
  display: none;
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: #1e293b;
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 400;
  width: 250px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  text-align: left;
  line-height: 1.4;
  white-space: normal;
}
.tooltip-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #1e293b transparent transparent transparent;
}
.tooltip-icon:hover .tooltip-box {
  display: block;
}

/* Tags Input */
.tags-input-container {
  position: relative;
  width: 100%;
}
.tags-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  min-height: 40px;
  cursor: text;
}
.tag-badge {
  background: rgba(186, 32, 37, 0.08);
  color: var(--brand-red);
  border: 1px solid rgba(186, 32, 37, 0.2);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.tag-badge .remove {
  cursor: pointer;
  color: var(--text-muted);
}
.tag-badge .remove:hover {
  color: var(--brand-red);
}
.tags-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 4px;
  display: none;
}
.tags-dropdown-item {
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
.tags-dropdown-item:hover {
  background: rgba(248, 250, 252, 1);
}

