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

* {
  box-sizing: border-box;
}

body {
  background-color: #f8fafc;
  background-image: 
    linear-gradient(#e2e8f0 1px, transparent 1px),
    linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 40px 24px;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 1200px;
}

/* Header styles */
.header-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 48px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-section img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.title-group h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
}

.title-group p {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.home-btn {
  position: absolute;
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #475569;
}

.home-btn:hover {
  background: #f8fafc;
  color: #0f172a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.home-btn svg {
  width: 22px;
  height: 22px;
}

.version-select {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}

.version-select:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.version-select svg {
  width: 14px;
  height: 14px;
}

/* 3-Column Services Grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 40px;
}

@media (max-width: 1024px) {
  .services-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .service-btn {
    pointer-events: none !important;
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #94a3b8 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
  }
}

.service-col {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.service-col:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.06);
}

.service-btn {
  width: 100%;
  padding: 16px 20px;
  background: #ccafe9;
  border: 1.5px solid #b18ad6;
  color: #2e104e;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(177, 138, 214, 0.15);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.service-btn.disabled {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #94a3b8;
  box-shadow: none;
  cursor: default;
}

.service-btn:not(.disabled):hover {
  background: #bf9be0;
  border-color: #a476cd;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(177, 138, 214, 0.25);
}

.service-btn:not(.disabled):active {
  transform: translateY(0);
}

.service-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.service-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 14px;
  margin-bottom: 12px;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
}

.service-description {
  font-size: 13.5px;
  color: #334155;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 24px;
  text-align: center;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scenario-label {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 8px;
  align-self: flex-start;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scenario-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.scenario-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Auth Modal Overlay styles */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 31, 58, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.auth-overlay .divider::before,
.auth-overlay .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e0e3ea;
}
.auth-overlay .divider:not(:empty)::before { margin-right: .5em; }
.auth-overlay .divider:not(:empty)::after { margin-left: .5em; }

.hidden {
  display: none !important;
}

/* Auth modal sub-elements */
.textai-card {
  border-radius: 12px;
  background: white;
}
.muted {
  color: #64748b;
  font-size: 13px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-decoration: none;
  font-family: inherit;
}
.button.primary {
  background-color: #8e44ad;
  color: #ffffff;
}
.button.primary:hover {
  background-color: #6c3483;
}

/* Header Actions Container */
.header-actions {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
}

/* Gear Settings Button & Logout Button */
.settings-btn,
.logout-btn {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4b5563;
  transition: all 0.2s ease;
  text-decoration: none;
}

/* Test Service Button for Rules Expert */
.test-expert-btn {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: white !important;
  border: 1px solid #1d4ed8;
  border-radius: 6px;
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  white-space: nowrap;
}

.test-expert-btn:hover {
  background: linear-gradient(135deg, #172554 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
  color: white !important;
}

.test-expert-btn svg {
  width: 17px;
  height: 17px;
}

.settings-btn:hover,
.logout-btn:hover {
  background-color: #f3f4f6;
  color: #c0392b; /* Exit button turns red on hover */
}

.settings-btn svg,
.logout-btn svg {
  width: 20px;
  height: 20px;
}

/* Settings Modal Overlay Styles */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 31, 58, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.settings-modal {
  background: white;
  border-radius: 12px;
  width: 95%;
  max-width: 1400px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  position: relative;
  border: 1px solid #e2e8f0;
}

.settings-modal h2 {
  margin: 0 0 24px 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.settings-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  color: #64748b;
  transition: color 0.2s;
}

.settings-close-btn:hover {
  color: #0f172a;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

@media (max-width: 640px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.settings-panel-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.settings-panel-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e3a8a;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 8px;
}

.settings-panel-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.settings-panel-card input[type="text"],
.settings-panel-card input[type="password"],
.settings-panel-card input[type="number"],
.settings-panel-card select,
.settings-panel-card textarea {
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  color: #1e293b;
  width: 100%;
}

.settings-panel-card textarea {
  max-height: 120px;
  overflow-y: auto;
  resize: vertical;
}

.settings-panel-card input:focus,
.settings-panel-card select:focus,
.settings-panel-card textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.settings-panel-card .muted {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.4;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.settings-save-btn {
  background-color: #2563eb;
  color: white;
  border: 1px solid #1d4ed8;
  padding: 10px 20px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.settings-save-btn:hover {
  background-color: #1d4ed8;
}

.settings-cancel-btn {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 10px 20px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.settings-cancel-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

