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

:root {
  --background: 11 15 25;
  --surface: 21 25 43;
  --surfaceHighlight: 30 36 61;
  --border: 42 49 77;
  --primary: 99 102 241;
  --primaryHover: 79 70 229;
  --secondary: 139 92 246;
  --textPrimary: 241 245 249;
  --textSecondary: 148 163 184;
}

html:not(.dark) {
  --background: 240 242 245;
  --surface: 255 255 255;
  --surfaceHighlight: 241 243 248;
  --border: 209 213 219;
  --primary: 79 70 229;
  --primaryHover: 67 56 202;
  --secondary: 124 58 237;
  --textPrimary: 30 41 59;
  --textSecondary: 100 116 139;
}

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(99, 102, 241, 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: #6366f1;
  font-size: 1.2rem;
  margin-top: 20px;
  text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.loader-ring {
  width: 120px;
  height: 120px;
  border: 2px solid transparent;
  border-top-color: #8b5cf6;
  border-right-color: #6366f1;
  border-bottom-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
  position: relative;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

.loader-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid transparent;
  border-top-color: #3b82f6;
  border-left-color: #6366f1;
  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%, #15192b 0%, #0b0f19 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: #6366f1;
  animation-delay: 0s;
}
.blob-2 {
  bottom: -10%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: #8b5cf6;
  animation-delay: -5s;
}
.blob-3 {
  top: 40%;
  left: 60%;
  width: 40%;
  height: 40%;
  background: #3b82f6;
  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(99, 102, 241, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 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;
  }
}

/* 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(99, 102, 241, 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(99, 102, 241, 0.5);
}
