/* =============================================================================
   CX SOLVED DASHBOARD - SHARED STYLES
   All colors use CSS variables set by theme.js
   ============================================================================= */

:root {
  /* Defaults (overridden by theme.js) */
  --primary: #0052CC;
  --primary-dark: #003d99;
  --primary-light: #E8F0FE;
  --primary-glow: rgba(0, 82, 204, 0.15);
  --heading-font: -apple-system, sans-serif;
  --body-font: -apple-system, sans-serif;

  /* Shared neutrals */
  --surface: #FAFBFC;
  --surface-card: #FFFFFF;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
}

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

body {
  font-family: var(--body-font);
  background: var(--surface);
  color: var(--text-primary);
  min-height: 100vh;
}

.hidden { display: none !important; }

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 32px;
}

/* =============================================================================
   HEADER
   ============================================================================= */

header {
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 19px;
  color: white;
  letter-spacing: -0.5px;
}

.logo-mark--image {
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
}

.logo-text {
  font-weight: 700;
  font-size: 22px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.15s;
}

.btn-ghost:hover {
  color: var(--text-secondary);
  background: var(--border-light);
}

/* Admin client switcher */
.client-switcher {
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.client-switcher:hover {
  background: var(--primary-light);
}

/* =============================================================================
   LOADING
   ============================================================================= */

.loading-screen {
  text-align: center;
  padding: 80px 0;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* =============================================================================
   LOGIN CARD
   ============================================================================= */

.login-card {
  max-width: 440px;
  margin: 40px auto;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

.login-card .subtitle strong {
  color: var(--text-primary);
}

.login-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--primary);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}

.remember-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.remember-row label {
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}

.login-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 10px;
  color: #DC2626;
  font-size: 14px;
}

.login-success-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.login-sent { text-align: center; }
.login-sent h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.login-sent p { color: var(--text-secondary); font-size: 15px; margin-bottom: 4px; }
.login-sent .hint { font-size: 13px; color: var(--text-muted); }

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  margin-top: 20px;
}

.btn-link:hover { text-decoration: underline; }

/* =============================================================================
   WELCOME SECTION
   ============================================================================= */

.welcome-section {
  padding: 28px 0 24px;
}

.welcome-greeting {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.welcome-name {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

/* =============================================================================
   CTA BANNER
   ============================================================================= */

.cta-banner {
  background: var(--primary);
  border-radius: 16px;
  padding: 34px 32px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: white;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 40px solid rgba(255,255,255,0.06);
  pointer-events: none;
}

.cta-banner::after {
  content: '';
  position: absolute;
  bottom: -60%;
  right: 10%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 30px solid rgba(255,255,255,0.04);
  pointer-events: none;
}

.cta-banner:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--primary-glow);
}

.cta-content {
  position: relative;
  z-index: 1;
}

.cta-title {
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 4px;
}

.cta-desc {
  font-size: 17px;
  opacity: 0.85;
}

.cta-arrow {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.cta-banner:hover .cta-arrow {
  background: rgba(255,255,255,0.3);
}

/* =============================================================================
   SECTIONS & CARDS
   ============================================================================= */

.section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 12px;
  padding-left: 2px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

.section-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card-grid--single {
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 28px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 4px 12px var(--primary-glow);
  transform: translateY(-2px);
}

.card-icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.card-icon svg {
  width: 28px;
  height: 28px;
}

.card-icon--blue { background: #EFF6FF; }
.card-icon--green { background: var(--primary-light); }
.card-icon--purple { background: #F3E8FF; }
.card-icon--amber { background: #FEF3C7; }
.card-icon--slate { background: #F1F5F9; }

.card-title {
  font-weight: 600;
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.card-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.card--disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  background: #F3F4F6;
}

.card--disabled:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--border-light);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
}

/* =============================================================================
   CLIENT PICKER (Admin users)
   ============================================================================= */

.client-picker {
  max-width: 560px;
  margin: 40px auto;
  text-align: center;
}

.client-picker h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.client-picker p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

.client-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.client-picker-card {
  background: var(--surface-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.client-picker-card:hover {
  border-color: var(--text-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.client-picker-card .picker-name {
  font-weight: 700;
  font-size: 20px;
  margin-top: 12px;
}

.client-picker-card .picker-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* =============================================================================
   SUBPAGE HEADER
   ============================================================================= */

.subpage-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.subpage-header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subpage-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: white;
}

/* =============================================================================
   FOOTER
   ============================================================================= */

footer {
  text-align: center;
  padding: 36px 0 28px;
  font-size: 15px;
  color: var(--text-muted);
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

footer a:hover {
  color: var(--primary);
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

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

.animate-in {
  animation: fadeUp 0.4s ease-out both;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }

.fade-in {
  animation: fadeUp 0.3s ease-in both;
}

/* =============================================================================
   MOBILE
   ============================================================================= */

@media (max-width: 480px) {
  .container { padding: 0 20px; }
  .welcome-name { font-size: 28px; }
  .welcome-greeting { font-size: 14px; }
  .card-grid { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 22px 20px; }
  .card-title { font-size: 17px; }
  .card-desc { font-size: 14px; }
  .cta-banner { padding: 22px 22px; }
  .cta-title { font-size: 18px; }
  .cta-desc { font-size: 14px; }
  .card-icon { width: 48px; height: 48px; }
  .login-card { margin: 20px auto; padding: 28px 24px; }
  .client-picker-grid { grid-template-columns: 1fr; }
  .subpage-header-inner { padding: 0 20px; }
}
