/* ============================================
   AI Messaging Toolkit — Medical Edition
   Matching Worthy Performance Group branding
   ============================================ */

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream: #f6f0e7;
  --cream-light: #faf7f2;
  --cream-dark: #ede5d8;
  --purple: #994a9e;
  --purple-light: #b06cb4;
  --dark-plum: #442b4d;
  --sidebar-bg: #2d1b35;
  --sidebar-hover: #3d2848;
  --sidebar-active: #4a3356;
  --bronze: #a87649;
  --bronze-light: #c4955e;
  --text-dark: #2c2231;
  --text-body: #4a3f52;
  --text-muted: #7a6f83;
  --text-light: #a89bb2;
  --white: #ffffff;
  --border: #e0d5c8;
  --card-bg: #faf8f4;
  --prompt-bg: #f5f0e8;
  --tip-bg: #faf7f1;
  --tip-border-basic: #994a9e;
  --tip-border-advanced: #c4955e;
  --bracket-color: #c4955e;
  --toggle-active: #994a9e;
  --font-sans: 'Work Sans', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-display: 'Work Sans', sans-serif;
  --font-body: 'Work Sans', sans-serif;
  --sidebar-width: 272px;
  --transition: 200ms ease;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--cream);
  min-height: 100dvh;
}

/* Logo images */
.logo-img {
  width: 120px;
  height: auto;
  border-radius: 8px;
}

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--cream);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(68, 43, 77, 0.06);
}

.login-logo {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.login-title {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  color: #442b4d;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.login-edition {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--purple);
  text-transform: uppercase;
  margin-bottom: 20px;
}

.login-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-light);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text-dark);
  background: var(--cream-light);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(153, 74, 158, 0.1);
}

.input-wrapper input::placeholder {
  color: var(--text-light);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  background: var(--purple);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.login-error {
  color: #c0392b;
  font-size: 13px;
  margin-top: 4px;
}

.login-footer {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app {
  display: flex;
  min-height: 100dvh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100dvh;
  background: var(--sidebar-bg);
  color: #e0d5c8;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  color: #f0e6d6;
  letter-spacing: 0.01em;
}

.sidebar-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--bronze-light);
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

/* Nav Items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  color: #c4b8a8;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  line-height: 1.4;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #f0e6d6;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #f0e6d6;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-module {
  font-weight: 600;
  color: #d4c5b0;
}

.nav-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-module .chevron {
  transition: transform var(--transition);
  opacity: 0.5;
}

.nav-module.expanded .chevron {
  transform: rotate(90deg);
}

.nav-sub-items {
  display: none;
  padding-left: 0;
}

.nav-sub-items.show {
  display: block;
}

.nav-sub-item {
  display: block;
  padding: 8px 20px 8px 48px;
  font-size: 13px;
  color: #a89bb2;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}

.nav-sub-item:hover {
  background: var(--sidebar-hover);
  color: #e0d5c8;
}

.nav-sub-item.active {
  background: var(--sidebar-active);
  color: #f0e6d6;
  font-weight: 500;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer-icons {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.sidebar-footer-icons a {
  color: #a89bb2;
  transition: color var(--transition);
}

.sidebar-footer-icons a:hover {
  color: #f0e6d6;
}

.sign-out-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  color: #a89bb2;
  cursor: pointer;
  transition: color var(--transition);
  background: none;
  border: none;
  padding: 4px 0;
}

.sign-out-btn:hover {
  color: #f0e6d6;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100dvh;
  padding: 48px 56px 80px;
  max-width: 100%;
  overflow-x: hidden;
}

/* ============================================
   WELCOME PAGE
   ============================================ */
.welcome-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.welcome-title {
  font-family: var(--font-sans);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  color: #442b4d;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.welcome-desc {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}

/* Info Cards Grid */
.info-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 800px;
  margin: 0 auto 48px;
}

.info-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.info-card-icon {
  color: var(--dark-plum);
  flex-shrink: 0;
}

.info-card-title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  color: #442b4d;
}

.info-card-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-body);
}

.info-card-text .bracket {
  color: var(--bracket-color);
  font-weight: 600;
}

/* Module Cards Grid */
.module-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.module-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.module-card:hover {
  border-color: var(--purple);
  box-shadow: 0 4px 16px rgba(153, 74, 158, 0.08);
  transform: translateY(-2px);
}

.module-card-icon {
  color: var(--purple);
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}

.module-card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-light);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.module-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

/* ============================================
   PROMPT PAGE
   ============================================ */
.prompt-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--purple);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.prompt-title {
  font-family: var(--font-sans);
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 700;
  color: #442b4d;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.prompt-when {
  font-size: 15px;
  color: var(--text-body);
  margin-bottom: 24px;
  line-height: 1.6;
}

.prompt-when strong {
  font-weight: 600;
  color: var(--text-dark);
}

.prompt-when em {
  font-style: italic;
  color: var(--text-muted);
}

/* Toggle */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
}

.toggle-label.active {
  color: var(--text-dark);
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  padding: 0;
}

.toggle-switch.on {
  background: var(--toggle-active);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch.on .toggle-knob {
  transform: translateX(20px);
}

/* Prompt Box */
.prompt-box {
  background: var(--prompt-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 28px 20px;
  margin-bottom: 16px;
  position: relative;
}

.prompt-text {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-dark);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.prompt-text .bracket {
  color: var(--bracket-color);
  font-weight: 600;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--purple);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.copy-btn:hover {
  background: var(--purple-light);
}

.copy-btn:active {
  transform: scale(0.97);
}

.copy-btn.copied {
  background: #5a8a3e;
}

/* Pro Tip Box */
.pro-tip {
  border-left: 4px solid var(--tip-border-basic);
  background: var(--tip-bg);
  border-radius: 0 10px 10px 0;
  padding: 20px 24px;
  margin-top: 20px;
}

.pro-tip.advanced {
  border-left-color: var(--tip-border-advanced);
}

.pro-tip-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--dark-plum);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.pro-tip.advanced .pro-tip-label {
  color: var(--bronze);
}

.pro-tip-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-body);
}

/* ============================================
   CHEAT SHEET
   ============================================ */
.cheat-title {
  font-family: var(--font-sans);
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 700;
  color: #442b4d;
  margin-bottom: 8px;
}

.cheat-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.cheat-section-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  color: #442b4d;
  margin-bottom: 16px;
  margin-top: 40px;
}

.cheat-section-title:first-of-type {
  margin-top: 0;
}

.cheat-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
  font-size: 14px;
}

.cheat-table thead th {
  background: var(--dark-plum);
  color: #f0e6d6;
  font-weight: 600;
  text-align: left;
  padding: 14px 16px;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.cheat-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.55;
}

.cheat-table tbody tr:nth-child(even) {
  background: var(--cream-light);
}

.cheat-table tbody tr:last-child td {
  border-bottom: none;
}

.cheat-table .letter-cell {
  font-weight: 700;
  color: var(--purple);
  white-space: nowrap;
}

/* ============================================
   HOW TO USE PAGE
   ============================================ */
.how-title {
  font-family: var(--font-sans);
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 700;
  color: #442b4d;
  margin-bottom: 8px;
}

.how-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ============================================
   PAGE FOOTER
   ============================================ */
.page-footer {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.7;
}

.page-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.page-footer a:hover {
  color: var(--purple);
}

.page-footer .footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.page-footer .footer-sep {
  color: var(--border);
}

/* ============================================
   MOBILE HEADER
   ============================================ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--sidebar-bg);
  color: #f0e6d6;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 90;
}

.hamburger {
  background: none;
  border: none;
  color: #f0e6d6;
  cursor: pointer;
  padding: 4px;
}

.mobile-title {
  font-size: 15px;
  font-weight: 600;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 95;
}

.sidebar-overlay.show {
  display: block;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .info-cards {
    grid-template-columns: 1fr;
  }
  .module-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }
  
  .sidebar {
    transform: translateX(-100%);
    transition: transform 300ms ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 72px 20px 60px;
  }
  
  .module-cards {
    grid-template-columns: 1fr 1fr;
  }
  
  .prompt-box {
    padding: 20px 18px 16px;
  }
  
  .cheat-table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .module-cards {
    grid-template-columns: 1fr;
  }
  
  .login-card {
    padding: 32px 24px 28px;
  }
}

/* ============================================
   SCROLLBAR
   ============================================ */
.main-content::-webkit-scrollbar {
  width: 6px;
}
.main-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Selection */
::selection {
  background: rgba(153, 74, 158, 0.15);
  color: var(--text-dark);
}
