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

:root {
  /* Color System */
  --bg-primary: #07111F;
  --bg-secondary: #0D1728;
  --card-bg: #FFFFFF;
  --input-bg: #FFFFFF;
  --border-color: #E2E8F0;
  --border-input: #E2E8F0;
  --border-dark: #1E293B;
  
  --primary-blue: #2563EB;
  --primary-hover: #1D4ED8;
  --gold: #F59E0B;
  --gold-highlight: #FBBF24;
  
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-dark-primary: #F8FAFC;
  --text-dark-secondary: #94A3B8;
  --text-muted: #94A3B8;
  
  --success: #16A34A;
  --error: #DC2626;
  --warning: #F59E0B;

  /* Typography */
  --font-family: 'Inter', sans-serif;
}

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

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

/* Background Effects */
.bg-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.bg-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37,99,235,0.08) 0%, rgba(7,17,31,0) 70%);
  z-index: 1;
}

.bg-grid {
  display: none;
}

.portal-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* Main Card */
.main-card {
  background-color: var(--card-bg);
  width: 100%;
  max-width: 680px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.85);
  padding: 32px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.30);
  position: relative;
  z-index: 10;
}

#agent-form {
  max-width: 560px;
  margin: 0 auto;
}

/* Logo Area */
.logo-area {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
}

.logo-glow {
  display: none;
}

.logo-placeholder {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.missing-logo-text {
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
}

/* Header */
.header-area {
  text-align: center;
  margin-bottom: 40px;
}

.header-title {
  font-size: 40px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
  letter-spacing: -0.6px;
}

@media (min-width: 768px) {
  .header-title {
    font-size: 44px;
  }
}

.header-subtitle {
  font-size: 16px;
  color: #64748B;
  line-height: 1.5;
  position: relative;
  padding-bottom: 24px;
}

.header-subtitle::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-blue), var(--gold));
  border-radius: 999px;
}

/* Form Group */
.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-label {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
  gap: 8px;
}

.form-label svg {
  width: 18px;
  height: 18px;
  color: var(--primary-blue);
}

/* Custom Dropdown */
.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 56px;
  background-color: #FFFFFF;
  border: 1px solid #DCE3EC;
  border-radius: 14px;
  padding: 0 20px;
  color: #111827;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.custom-select-trigger:hover {
  border-color: #CBD5E1;
  background-color: #F8FAFC;
}

.custom-select-trigger.active {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.custom-select-placeholder {
  color: #94A3B8;
}

.custom-select-value {
  color: #111827;
}

.custom-select-icon {
  width: 20px;
  height: 20px;
  color: #64748B;
  transition: transform 0.2s ease;
}

.custom-select-trigger.active .custom-select-icon {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background-color: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all 0.15s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.custom-select-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select-search {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.custom-select-search input {
  width: 100%;
  height: 40px;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  font-family: var(--font-family);
  transition: border-color 0.2s;
}

.custom-select-search input:focus {
  border-color: var(--primary-blue);
}

.custom-select-search input::placeholder {
  color: var(--text-muted);
}

.custom-select-options {
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
}

/* Custom Scrollbar for dropdowns */
.custom-select-options::-webkit-scrollbar {
  width: 6px;
}
.custom-select-options::-webkit-scrollbar-track {
  background: transparent;
}
.custom-select-options::-webkit-scrollbar-thumb {
  background: var(--input-bg);
  border-radius: 10px;
}
.custom-select-options::-webkit-scrollbar-thumb:hover {
  background: var(--border-input);
}

.custom-select-option {
  padding: 14px 16px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 15px;
  transition: background-color 0.1s ease;
  display: flex;
  align-items: center;
}

.custom-select-option:hover, .custom-select-option.focused {
  background-color: #EFF6FF;
}

.custom-select-option.selected {
  background-color: #EFF6FF;
  color: #111827;
  font-weight: 500;
}

.no-results {
  padding: 12px 16px;
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
}

/* Button */
.btn-primary {
  width: 100%;
  max-width: 560px;
  margin: 32px auto 0 auto;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-blue), #1D4ED8);
  border: none;
  border-radius: 14px;
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.20);
}

.btn-primary .btn-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary .arrow {
  transition: transform 0.2s ease;
}

.btn-primary:hover .arrow {
  transform: translateX(3px);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(37, 99, 235, 0.25);
  background-color: var(--primary-hover);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--input-bg);
  color: var(--text-muted);
  box-shadow: none;
  opacity: 0.8;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.btn-primary.loading .spinner {
  display: block;
}
.btn-primary.loading .btn-text {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Result Card */
.result-card {
  margin: 32px auto 0 auto;
  max-width: 560px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 24px;
  display: none; /* Hidden by default */
  animation: resultFadeIn 0.18s ease forwards;
}

.result-card.show {
  display: block;
}

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

.result-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 16px;
}

.result-type {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
  background-color: rgba(34, 197, 94, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
}

.result-body {
  margin-bottom: 24px;
}

.result-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.result-name {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 24px;
}

.result-context {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

@media (min-width: 480px) {
  .result-context {
    grid-template-columns: repeat(3, 1fr);
  }
}

.context-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.context-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.context-value {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.result-url-container {
  background-color: var(--input-bg);
  border: 1px solid var(--border-input);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.result-url {
  color: var(--text-primary);
  font-family: monospace;
  font-size: 14px;
  word-break: break-all;
  white-space: normal;
  user-select: all;
  line-height: 1.4;
}

.btn-copy {
  width: 100%;
  height: 48px;
  background-color: #0F172A;
  border: 1px solid #0F172A;
  border-radius: 12px;
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-copy:hover {
  background-color: #1E293B;
  border-color: #1E293B;
}

.btn-copy.copied {
  background-color: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.portal-footer {
  text-align: center;
  margin-top: 32px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Hide native selects since we are using custom ones */
.native-select-hidden {
  display: none;
}

/* Mobile Responsiveness for Agent Portal */
@media (max-width: 480px) {
  .portal-container {
    padding: 16px;
    align-items: flex-start;
  }
  
  .main-card {
    padding: 24px 20px;
    border-radius: 20px;
    margin-top: 10px;
  }
  
  .header-title {
    font-size: 32px;
  }
  
  .header-subtitle {
    font-size: 14px;
  }
  
  .custom-select-trigger, .btn-primary, .btn-copy {
    height: 52px;
  }
  
  .logo-placeholder {
    width: 65px;
    height: 65px;
  }
  
  .logo-glow {
    width: 85px;
    height: 85px;
  }
  
  .result-card {
    padding: 20px;
  }
}

/* ==================================================
   PREMIUM CLICK ANIMATION SYSTEM 
   ================================================== */

.btn-primary, .btn-secondary, .btn-copy, .btn-danger, .icon-btn, .action-btn {
  position: relative;
  overflow: hidden;
}

.btn-primary:active, .btn-secondary:active, .btn-copy:active, .btn-danger:active {
  transform: scale(0.985) !important;
  transition: transform 80ms ease-out !important;
}

.click-sweep {
  position: absolute;
  top: 0;
  left: -30%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  transform: skewX(-20deg);
  pointer-events: none;
  animation: premiumLightSweep 500ms ease-out forwards;
  z-index: 10;
}

/* Destructive buttons */
.btn-danger .click-sweep {
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.18),
    transparent
  );
}

@keyframes premiumLightSweep {
  0% {
    left: -30%;
  }
  100% {
    left: 130%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .click-sweep {
    display: none;
  }
}
