/* ==========================================
   ConcordIA Portal - Styles
   ========================================== */

:root {
  --background: 6 13 31;
  --surface: 12 21 48;
  --surfaceHighlight: 19 32 68;
  --border: 26 45 90;
  --primary: 90 138 40;
  --primaryHover: 72 114 28;
  --secondary: 14 110 184;
  --accent: 0 212 232;
  --textPrimary: 232 240 254;
  --textSecondary: 122 148 184;
}

html:not(.dark) {
  --background: 240 244 248;
  --surface: 255 255 255;
  --surfaceHighlight: 232 238 244;
  --border: 196 209 222;
  --primary: 90 138 40;
  --primaryHover: 72 114 28;
  --secondary: 14 110 184;
  --accent: 0 163 181;
  --textPrimary: 13 27 62;
  --textSecondary: 90 112 137;
}

select.input-modern,
input.input-modern,
textarea.input-modern {
  color: rgb(var(--textPrimary)) !important;
  background-color: rgba(11, 15, 25, 0.6) !important;
}
html:not(.dark) select.input-modern,
html:not(.dark) input.input-modern,
html:not(.dark) textarea.input-modern {
  background-color: rgba(255, 255, 255, 0.9) !important;
  border-color: rgb(var(--border)) !important;
}

option {
  background-color: rgb(var(--surfaceHighlight));
  color: rgb(var(--textPrimary));
}
optgroup {
  background-color: rgb(var(--surface));
  color: rgb(var(--primary));
  font-weight: bold;
}

body {
  font-family: "Inter", sans-serif;
  background-color: rgb(var(--background));
  color: rgb(var(--textPrimary));
  overflow-x: hidden;
}

html:not(.dark) .bg-animated {
  background: radial-gradient(circle at 50% 50%, #e8ebf0 0%, #f0f2f5 100%);
}
html:not(.dark) .bg-blob {
  opacity: 0.12;
}
html:not(.dark) .glass-panel {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
html:not(.dark) .input-modern {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgb(var(--border));
  color: rgb(var(--textPrimary));
}
html:not(.dark) .api-key-selector .dropdown {
  background: rgb(var(--surface));
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}
html:not(.dark) .api-key-selector .dropdown-item:hover {
  background: rgb(var(--surfaceHighlight));
}
html:not(.dark) ::-webkit-scrollbar-thumb {
  background: rgba(14, 110, 184, 0.25);
}

/* Hollywood-style loading screen */
#loading-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition:
    opacity 1s ease-in-out,
    visibility 1s ease-in-out;
}

.hacker-text {
  font-family: "Fira Code", monospace;
  color: #5a8a28;
  font-size: 1.2rem;
  margin-top: 20px;
  text-shadow: 0 0 10px rgba(90, 138, 40, 0.5);
}

.loader-ring {
  width: 120px;
  height: 120px;
  border: 2px solid transparent;
  border-top-color: #5a8a28;
  border-right-color: #0e6eb8;
  border-bottom-color: #00d4e8;
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
  position: relative;
  box-shadow: 0 0 30px rgba(14, 110, 184, 0.2);
}

.loader-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid transparent;
  border-top-color: #00d4e8;
  border-left-color: #5a8a28;
  border-radius: 50%;
  animation: spin-reverse 2s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}
@keyframes spin-reverse {
  100% {
    transform: rotate(-360deg);
  }
}

/* Animated Background */
.bg-animated {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, #0c1530 0%, #060d1f 100%);
  overflow: hidden;
}

.bg-blob {
  position: absolute;
  filter: blur(100px);
  opacity: 0.4;
  animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: #5a8a28;
  animation-delay: 0s;
}
.blob-2 {
  bottom: -10%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: #0e6eb8;
  animation-delay: -5s;
}
.blob-3 {
  top: 40%;
  left: 60%;
  width: 40%;
  height: 40%;
  background: #0a3d6b;
  animation-delay: -10s;
  opacity: 0.3;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(5%, 10%) scale(1.1);
  }
  66% {
    transform: translate(-5%, 5%) scale(0.9);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

/* Glassmorphism */
.glass-panel {
  background: rgba(21, 25, 43, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Inputs */
.input-modern {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgb(var(--textPrimary));
  transition: all 0.3s ease;
}
.input-modern:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 2px rgb(var(--primary) / 0.2);
  outline: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(14, 110, 184, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 110, 184, 0.5);
}

/* Layout State toggles */
#app-layout {
  display: none;
}

/* Theme transition */
.theme-transition {
  transition:
    background-color 0.5s ease,
    color 0.5s ease,
    border-color 0.5s ease;
}

/* Notification toasts */
.notification-toast {
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Audio interaction animations */
.recording-active {
  animation: recordingPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
}

@keyframes recordingPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  70% {
    transform: scale(1.04);
    box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.audio-pulse-wrap {
  position: relative;
}

.audio-pulse-wrap .audio-bar {
  position: absolute;
  bottom: 20px;
  width: 3px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.8);
  animation: audioWave 1s ease-in-out infinite;
}

.audio-pulse-wrap .audio-bar-1 {
  left: 18px;
  height: 20px;
  animation-delay: 0s;
}

.audio-pulse-wrap .audio-bar-2 {
  left: 24px;
  height: 14px;
  animation-delay: 0.2s;
}

.audio-pulse-wrap .audio-bar-3 {
  left: 30px;
  height: 18px;
  animation-delay: 0.4s;
}

@keyframes audioWave {
  0%,
  100% {
    transform: scaleY(0.6);
    opacity: 0.5;
  }
  50% {
    transform: scaleY(1.15);
    opacity: 1;
  }
}

/* Long response collapsible block */
.preview-collapsible summary {
  list-style: none;
}

.preview-collapsible summary::-webkit-details-marker {
  display: none;
}

.preview-collapsible summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.2s ease;
}

.preview-collapsible[open] summary::before {
  transform: rotate(90deg);
}

/* API Key selector dropdown */
.api-key-selector {
  position: relative;
}
.api-key-selector .dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 0.75rem;
  margin-top: 4px;
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.api-key-selector .dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.api-key-selector .dropdown-item:hover {
  background: rgb(var(--surfaceHighlight));
}
.api-key-selector .dropdown-item.active {
  background: rgba(14, 110, 184, 0.15);
  color: rgb(var(--primary));
}

/* User profile section */
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  background: linear-gradient(
    135deg,
    rgb(var(--primary)),
    rgb(var(--secondary))
  );
  box-shadow: 0 0 10px rgba(14, 110, 184, 0.5);
}
