/* ==========================================================================
   Centralized Web-Based Calling Bell System - Design System & Stylesheet
   ========================================================================== */

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

:root {
  --bg-main: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 38, 58, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.4);
  --accent-indigo: #6366f1;
  --accent-indigo-glow: rgba(99, 102, 241, 0.35);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --bell-gold: #fbbf24;
  --bell-gold-glow: rgba(251, 191, 36, 0.5);

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-glow-cyan: 0 0 25px rgba(56, 189, 248, 0.35);
  --shadow-glow-gold: 0 0 35px rgba(251, 191, 36, 0.45);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(56, 189, 248, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(9, 13, 22, 0.8);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  animation: gentle-tilt 3s ease-in-out infinite alternate;
}

@keyframes gentle-tilt {
  0% { transform: rotate(-4deg); }
  100% { transform: rotate(4deg); }
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #f8fafc, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

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

.nav-link.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.25);
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */

.main-container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  flex: 1;
  width: 100%;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Tactile Ring Bell Button & Pulse Animation
   ========================================================================== */

.bell-trigger-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 2.5rem 0;
  position: relative;
}

.bell-btn-glow-ring {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bell-gold-glow) 0%, transparent 70%);
  animation: pulse-ring 2.5s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes pulse-ring {
  0% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 0.3; }
  100% { transform: scale(0.85); opacity: 0.8; }
}

.btn-ring-bell {
  position: relative;
  z-index: 2;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  background: radial-gradient(circle at 35% 35%, #fbbf24 0%, #d97706 60%, #92400e 100%);
  box-shadow: 
    0 15px 35px rgba(217, 119, 6, 0.45),
    0 0 0 8px rgba(251, 191, 36, 0.25),
    0 0 0 16px rgba(251, 191, 36, 0.1),
    inset 0 4px 10px rgba(255, 255, 255, 0.6),
    inset 0 -6px 12px rgba(0, 0, 0, 0.4);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn-ring-bell:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 
    0 20px 45px rgba(217, 119, 6, 0.6),
    0 0 0 10px rgba(251, 191, 36, 0.35),
    0 0 0 20px rgba(251, 191, 36, 0.15),
    inset 0 4px 12px rgba(255, 255, 255, 0.7);
}

.btn-ring-bell:active {
  transform: translateY(4px) scale(0.96);
  box-shadow: 
    0 5px 15px rgba(217, 119, 6, 0.5),
    0 0 0 6px rgba(251, 191, 36, 0.3),
    inset 0 -2px 6px rgba(255, 255, 255, 0.3),
    inset 0 6px 14px rgba(0, 0, 0, 0.6);
}

.btn-ring-bell .bell-icon {
  font-size: 3.6rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s ease;
}

.btn-ring-bell:hover .bell-icon {
  animation: bell-shake 0.4s ease infinite alternate;
}

.btn-ring-bell .bell-label {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.btn-ring-bell.is-ringing {
  animation: bell-pulse 0.6s ease infinite alternate;
}

@keyframes bell-shake {
  0% { transform: rotate(-12deg); }
  100% { transform: rotate(12deg); }
}

@keyframes bell-pulse {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.06); filter: brightness(1.25); }
}

/* ==========================================================================
   Branch Unit (Listener) Calling & Alert Strobe
   ========================================================================== */

.strobe-alert-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.45) 0%, rgba(245, 158, 11, 0.2) 70%);
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.strobe-alert-overlay.active {
  animation: screen-strobe 0.35s ease-in-out infinite alternate;
  opacity: 1;
}

@keyframes screen-strobe {
  0% { opacity: 0.15; background-color: rgba(251, 191, 36, 0.15); }
  100% { opacity: 0.75; background-color: rgba(251, 191, 36, 0.55); }
}

.listener-display-card {
  text-align: center;
  padding: 3.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.listener-display-card.ringing {
  border-color: var(--bell-gold);
  box-shadow: 0 0 50px var(--bell-gold-glow);
}

.calling-banner {
  display: none;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  padding: 1.25rem 2rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.5);
  animation: banner-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.calling-banner.visible {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

@keyframes banner-pop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Form Controls, Badges & Interactive Selectors
   ========================================================================== */

.section-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.control-group {
  margin-bottom: 1.5rem;
}

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

.sound-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.sound-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 500;
}

.sound-btn .icon {
  font-size: 1.3rem;
}

.sound-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.sound-btn.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

/* Branch Grid Selector */
.branches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.branch-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.branch-chip:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

.branch-chip.selected {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(56, 189, 248, 0.25));
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

/* Status Indicators & Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-pill.online .status-dot {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.status-pill.offline .status-dot {
  background: var(--accent-rose);
  box-shadow: 0 0 8px var(--accent-rose);
}

.status-pill.ringing .status-dot {
  background: var(--bell-gold);
  box-shadow: 0 0 10px var(--bell-gold);
  animation: pulse-dot 0.5s infinite alternate;
}

@keyframes pulse-dot {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 1; }
}

/* Inputs & Textareas */
.input-text, .select-custom {
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-text:focus, .select-custom:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Standard Action Buttons */
.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

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

/* Audio Autoplay Unlock Prompt Banner */
.audio-unlock-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.audio-unlock-text h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: #fbbf24;
  margin-bottom: 0.25rem;
}

.audio-unlock-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* History Log List */
.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 280px;
  overflow-y: auto;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.history-item .event-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.history-item .event-tag {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
}

.history-item .time-ago {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Multi-Branch Simulator Grid */
.simulator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.branch-sim-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.3s ease;
  position: relative;
}

.branch-sim-card.ringing {
  border-color: var(--bell-gold);
  background: rgba(251, 191, 36, 0.12);
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.3);
  transform: translateY(-2px);
}

.branch-sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.branch-sim-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
}

.branch-sim-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .btn-ring-bell {
    width: 170px;
    height: 170px;
  }
  .btn-ring-bell .bell-icon {
    font-size: 2.8rem;
  }
  .bell-btn-glow-ring {
    width: 190px;
    height: 190px;
  }
  .card {
    padding: 1.25rem;
  }
}
