/* =============================================
   BASE STATION PLATFORM - style.css
   Premium Dark Glassmorphic Design System
   ============================================= */

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

/* =============================================
   CSS Custom Properties & Design Tokens
   ============================================= */
:root {
  /* Base Colors */
  --bg-primary:        #070d1a;
  --bg-secondary:      #0b1326;
  --bg-card:           rgba(13, 25, 52, 0.7);
  --bg-glass:          rgba(255, 255, 255, 0.04);
  --bg-glass-hover:    rgba(255, 255, 255, 0.07);
  --bg-input:          rgba(255, 255, 255, 0.06);

  /* Text Colors */
  --text-primary:      #eaf2ff;
  --text-secondary:    #7a93b8;
  --text-muted:        #3d5a82;
  --text-white:        #ffffff;

  /* Department Accent Colors */
  --accent-field:      #00f0ff;
  --accent-field-glow: rgba(0, 240, 255, 0.25);
  --accent-field-dim:  rgba(0, 240, 255, 0.12);
  --accent-it:         #bd52ff;
  --accent-it-glow:    rgba(189, 82, 255, 0.25);
  --accent-it-dim:     rgba(189, 82, 255, 0.12);
  --accent-proc:       #ff7a00;
  --accent-proc-glow:  rgba(255, 122, 0, 0.25);
  --accent-proc-dim:   rgba(255, 122, 0, 0.12);
  --accent-global:     #3b82f6;
  --accent-global-glow:rgba(59, 130, 246, 0.25);

  /* Status Colors */
  --status-pending:    #ffc107;
  --status-pending-bg: rgba(255, 193, 7, 0.12);
  --status-done:       #00e676;
  --status-done-bg:    rgba(0, 230, 118, 0.12);
  --status-critical:   #ff4c4c;
  --status-critical-bg:rgba(255, 76, 76, 0.15);
  --status-high:       #ff7a00;
  --status-medium:     #ffc107;
  --status-low:        #00e676;

  /* Borders & Dividers */
  --border-color:      rgba(255, 255, 255, 0.07);
  --border-glass:      rgba(255, 255, 255, 0.1);
  --border-accent:     rgba(0, 240, 255, 0.3);

  /* Shadows */
  --shadow-sm:         0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:         0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:         0 8px 40px rgba(0,0,0,0.6);
  --shadow-glow-field: 0 0 20px rgba(0,240,255,0.2);
  --shadow-glow-it:    0 0 20px rgba(189,82,255,0.2);
  --shadow-glow-proc:  0 0 20px rgba(255,122,0,0.2);

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Typography */
  --font-body:    'Inter', sans-serif;
  --font-heading: 'Rajdhani', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Animated dot grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 70% 60% at 20% 10%, rgba(0,240,255,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 85%, rgba(189,82,255,0.06) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle fill='%23ffffff' opacity='0.02' cx='20' cy='20' r='1'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* =============================================
   Typography
   ============================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.1rem; }

.text-cyan    { color: var(--accent-field); }
.text-purple  { color: var(--accent-it); }
.text-orange  { color: var(--accent-proc); }
.text-blue    { color: var(--accent-global); }
.text-muted   { color: var(--text-secondary); }
.text-white   { color: var(--text-white); }

/* =============================================
   Navigation
   ============================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(7, 13, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-field) 0%, var(--accent-it) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #000;
  box-shadow: 0 0 12px rgba(0,240,255,0.4);
  flex-shrink: 0;
}

.navbar-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-white);
}

.navbar-title span { color: var(--accent-field); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.navbar-nav a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.navbar-nav a.active {
  color: var(--accent-field);
  box-shadow: inset 0 0 0 1px var(--accent-field-dim);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 500;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-field), var(--accent-it));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}

/* =============================================
   Containers & Layout
   ============================================= */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-sm {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-main { padding: 2rem 0 4rem; }

.grid {
  display: grid;
  gap: 1.5rem;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }

/* =============================================
   Card / Glass Components
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Glass panel with accent border */
.glass-panel {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Department accent cards */
.card-field  { border-color: var(--accent-field-dim); }
.card-it     { border-color: var(--accent-it-dim); }
.card-proc   { border-color: var(--accent-proc-dim); }

.card-field:hover  { border-color: rgba(0,240,255,0.3); box-shadow: var(--shadow-glow-field); }
.card-it:hover     { border-color: rgba(189,82,255,0.3); box-shadow: var(--shadow-glow-it); }
.card-proc:hover   { border-color: rgba(255,122,0,0.3); box-shadow: var(--shadow-glow-proc); }

/* =============================================
   Buttons
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.3rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-field) 0%, #00a8b5 100%);
  color: #000;
  box-shadow: 0 0 16px var(--accent-field-glow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 28px rgba(0,240,255,0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent-field-dim);
}

.btn-it {
  background: linear-gradient(135deg, var(--accent-it) 0%, #8b2fc7 100%);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-it-glow);
}
.btn-it:hover:not(:disabled) {
  box-shadow: 0 0 28px rgba(189,82,255,0.5);
  transform: translateY(-1px);
}

.btn-proc {
  background: linear-gradient(135deg, var(--accent-proc) 0%, #c45e00 100%);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-proc-glow);
}
.btn-proc:hover:not(:disabled) {
  box-shadow: 0 0 28px rgba(255,122,0,0.5);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ff4c4c 0%, #c00 100%);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  box-shadow: 0 0 20px rgba(255,76,76,0.5);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}
.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}
.btn-full { width: 100%; }

/* =============================================
   Forms
   ============================================= */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-field);
  box-shadow: 0 0 0 3px var(--accent-field-dim);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
select.form-control option {
  background: #0b1326;
  color: var(--text-primary);
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

/* =============================================
   Badge / Status Labels
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.7rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-pending   { background: var(--status-pending-bg);  color: var(--status-pending); border: 1px solid rgba(255,193,7,0.3); }
.badge-done      { background: var(--status-done-bg);     color: var(--status-done);    border: 1px solid rgba(0,230,118,0.3); }
.badge-critical  { background: var(--status-critical-bg); color: var(--status-critical);border: 1px solid rgba(255,76,76,0.3); }
.badge-high      { background: var(--accent-proc-dim);    color: var(--accent-proc);    border: 1px solid rgba(255,122,0,0.3); }
.badge-medium    { background: var(--status-pending-bg);  color: var(--status-medium);  border: 1px solid rgba(255,193,7,0.3); }
.badge-low       { background: var(--status-done-bg);     color: var(--status-low);     border: 1px solid rgba(0,230,118,0.3); }
.badge-field     { background: var(--accent-field-dim);   color: var(--accent-field);   border: 1px solid rgba(0,240,255,0.3); }
.badge-it        { background: var(--accent-it-dim);      color: var(--accent-it);      border: 1px solid rgba(189,82,255,0.3); }
.badge-proc      { background: var(--accent-proc-dim);    color: var(--accent-proc);    border: 1px solid rgba(255,122,0,0.3); }

/* =============================================
   Stats / KPI Cards
   ============================================= */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-color, var(--accent-field)), transparent);
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* =============================================
   Fault Cards
   ============================================= */
.fault-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.fault-column {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  min-height: 300px;
}

.fault-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.fault-column-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fault-count {
  background: var(--bg-glass-hover);
  border-radius: 100px;
  padding: 0.1rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.fault-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-field);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.25s ease;
  position: relative;
}

.fault-card:last-child { margin-bottom: 0; }
.fault-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); background: var(--bg-glass-hover); }

.fault-card.priority-critical { border-left-color: var(--status-critical); }
.fault-card.priority-high     { border-left-color: var(--accent-proc); }
.fault-card.priority-medium   { border-left-color: var(--status-pending); }
.fault-card.priority-low      { border-left-color: var(--status-done); }

.fault-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.fault-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  flex: 1;
}

.fault-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.fault-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fault-station {
  font-size: 0.78rem;
  color: var(--accent-field);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.fault-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.assign-select {
  flex: 1;
  min-width: 120px;
  padding: 0.3rem 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.2s;
  outline: none;
}
.assign-select:focus { border-color: var(--accent-field); }
.assign-select option { background: #0b1326; }

/* =============================================
   Chat UI
   ============================================= */
.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 120px);
  min-height: 500px;
}

.chat-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.chat-sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-sidebar-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem;
}

.chat-sidebar-list::-webkit-scrollbar { width: 4px; }
.chat-sidebar-list::-webkit-scrollbar-track { background: transparent; }
.chat-sidebar-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.chat-room-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  text-align: left;
}

.chat-room-btn:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.chat-room-btn.active { background: var(--accent-field-dim); color: var(--accent-field); }
.chat-room-btn .room-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.chat-room-btn.active .room-dot { background: var(--accent-field); box-shadow: 0 0 6px var(--accent-field); }

.chat-room-btn.dept-it.active  { background: var(--accent-it-dim); color: var(--accent-it); }
.chat-room-btn.dept-it.active .room-dot { background: var(--accent-it); }
.chat-room-btn.dept-proc.active{ background: var(--accent-proc-dim); color: var(--accent-proc); }
.chat-room-btn.dept-proc.active .room-dot { background: var(--accent-proc); }

.chat-divider {
  margin: 0.5rem 0.85rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chat-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.chat-main-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-room-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-room-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.chat-msg {
  display: flex;
  gap: 0.75rem;
  animation: msgSlideIn 0.25s ease;
}

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

.chat-msg.own {
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-field), var(--accent-it));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-msg-body { max-width: 70%; }

.chat-msg-sender {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.chat-msg.own .chat-msg-sender { text-align: right; }

.chat-msg-bubble {
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  background: var(--bg-glass-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  word-break: break-word;
}

.chat-msg.own .chat-msg-bubble {
  background: var(--accent-field-dim);
  border-color: rgba(0,240,255,0.2);
  color: var(--text-white);
}

.chat-msg-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.chat-msg.own .chat-msg-time { text-align: right; }

.chat-input-area {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.65rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-height: 120px;
}

.chat-input:focus {
  border-color: var(--accent-field);
  box-shadow: 0 0 0 3px var(--accent-field-dim);
}

.chat-notice {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* =============================================
   Auth Pages (Login / Register)
   ============================================= */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.5s ease;
}

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

.auth-header { text-align: center; margin-bottom: 2rem; }

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-field) 0%, var(--accent-it) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: #000;
  margin: 0 auto 1rem;
  box-shadow: 0 0 24px rgba(0,240,255,0.4);
}

.auth-header h2 { margin-bottom: 0.4rem; }
.auth-header p  { color: var(--text-secondary); font-size: 0.9rem; }

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-footer a { color: var(--accent-field); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* =============================================
   Alert Messages
   ============================================= */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-error   { background: rgba(255,76,76,0.12);  border-color: rgba(255,76,76,0.3);  color: #ff8f8f; }
.alert-success { background: rgba(0,230,118,0.12);  border-color: rgba(0,230,118,0.3);  color: #72ffbb; }
.alert-info    { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); color: #93c5fd; }

/* =============================================
   Page Header / Hero Sections
   ============================================= */
.page-hero {
  padding: 3rem 0 2rem;
  position: relative;
}

.page-hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-white) 0%, var(--accent-field) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-hero-sub {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
}

/* Landing Hero */
.hero-section {
  min-height: 90vh;
  display: flex;
  align-items: center;
  padding: 4rem 0;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,240,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: var(--accent-field-dim);
  border: 1px solid rgba(0,240,255,0.2);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-field);
  margin-bottom: 1.5rem;
}

.hero-badge .pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-field);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.5); }
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--accent-field) 0%, var(--accent-it) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 560px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =============================================
   Department Section / Feature Cards
   ============================================= */
.dept-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.dept-card::after {
  content: '';
  position: absolute;
  bottom: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--dept-glow, var(--accent-field-glow)) 0%, transparent 70%);
  pointer-events: none;
}

.dept-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--dept-border, var(--accent-field-dim));
}

.dept-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* =============================================
   Scrollbar Global
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =============================================
   Toast Notifications
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: toastIn 0.35s ease, toastOut 0.35s ease 2.65s forwards;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(20px); } }

.toast-success { border-left: 3px solid var(--status-done);    color: var(--status-done); }
.toast-error   { border-left: 3px solid var(--status-critical); color: var(--status-critical); }
.toast-info    { border-left: 3px solid var(--accent-field);    color: var(--accent-field); }

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 1024px) {
  .fault-board { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-sidebar { max-height: 220px; }
  .chat-messages { min-height: 300px; max-height: 400px; }
}

@media (max-width: 768px) {
  .navbar { padding: 0.8rem 1rem; }
  .navbar-title { display: none; }
  .navbar-nav a span { display: none; }
  .navbar-nav a { padding: 0.45rem 0.65rem; }
  .container { padding: 0 1rem; }
  .auth-card { padding: 1.75rem; }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
}

/* =============================================
   Utility Classes
   ============================================= */
.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.mb-4  { margin-bottom: 2rem; }
.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mt-4  { margin-top: 2rem; }
.p-0   { padding: 0; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.divider { border: none; border-top: 1px solid var(--border-color); margin: 1.5rem 0; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 500; }
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 600;
  width: 90%;
  max-width: 560px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s ease;
}

/* =============================================
   WebRTC Call UI Styling
   ============================================= */
.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 18, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.call-card {
  width: 90%;
  max-width: 680px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.call-header {
  text-align: center;
  margin-bottom: 2rem;
  z-index: 10;
}

.call-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-field) 0%, var(--accent-it) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 1rem;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
  animation: pulseCall 2s infinite;
}

@keyframes pulseCall {
  0% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(0, 240, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0); }
}

.call-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 0.35rem;
}

.call-header p {
  font-size: 0.9rem;
  color: var(--accent-field);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.call-video-container {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.local-video {
  width: 130px;
  height: 90px;
  object-fit: cover;
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-lg);
  background: #222;
  z-index: 20;
}

.call-controls {
  display: flex;
  gap: 1.25rem;
  z-index: 10;
}

.call-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.call-btn.btn-active {
  background: var(--bg-glass-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.call-btn.btn-active:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-white);
  transform: scale(1.05);
}

.call-btn.btn-disabled {
  background: rgba(255, 76, 76, 0.2);
  border: 1px solid rgba(255, 76, 76, 0.4);
  color: #ff8f8f;
}

.call-btn.btn-disabled:hover {
  background: rgba(255, 76, 76, 0.3);
  transform: scale(1.05);
}

.call-btn.btn-hangup {
  background: #ff4c4c;
  color: #fff;
}

.call-btn.btn-hangup:hover {
  background: #ff3333;
  box-shadow: 0 0 15px rgba(255, 76, 76, 0.5);
  transform: scale(1.05);
}
