/* ============================================
   ThriveHQ — css/style.css
   Synced with coach4u-shared design system v2.2
   ============================================ */

/*
  No external fonts required — uses the Aptos system font stack.
  Do NOT add Google Fonts link tags to HTML pages.
*/

/* ----- CSS Variables (synced with coach4u-shared v2.2) ----- */
:root {
  /* Brand Lock — must match templates/PROFILE.md */
  --primary:        #003366;   /* navy: headings, titles, header */
  --primary-dark:   #002244;   /* navy hover */
  --accent:         #0D9488;   /* teal: borders, buttons, links */
  --accent-dark:    #0F766E;   /* teal hover */
  --text:           #333333;   /* body text */
  --text-muted:     #888888;   /* secondary UI text only */
  --divider:        #eeeeee;   /* dividers and subtle backgrounds */

  /* ThriveHQ pulse pillars (app-specific UI accents, not brand) */
  --capacity:       #0D9488;
  --wellbeing:      #5DADE2;
  --strengths:      #B19CD9;
  --execution:      #7851A9;

  /* Neutrals */
  --bg:             #ffffff;
  --surface:        #ffffff;
  --border:         #e2e8f0;

  /* ThriveHQ extensions */
  --text-light:     #ADB5BD;
  --shadow-neutral: 0 2px 8px rgba(0,0,0,0.07);

  /* Typography — Aptos system stack (no Google Fonts required) */
  --font-body:      'Aptos', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading:   'Aptos', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow:         0 2px 8px rgba(13,148,136,0.12);
  --shadow-md:      0 4px 12px rgba(13,148,136,0.15);
  --shadow-lg:      0 6px 16px rgba(13,148,136,0.22);
}

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

/*
  IMPORTANT: Do NOT add display:flex or flex-direction:column to body.
  Auth pages use their own centred layout. Adding it globally breaks login.
*/
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }

h1, h2, h3, h4, h5, h6,
.login-title, .page-title, .header-title,
.login-logo h1 {
  font-family: var(--font-heading);
  font-weight: 700;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; }
img { max-width: 100%; display: block; }

/* ----- Forms ----- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group textarea { min-height: 100px; resize: vertical; }

/* ----- Login Page ----- */
.login-page {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 12px;
  padding: 32px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo h1 { font-size: 24px; font-weight: 700; color: var(--primary); letter-spacing: -0.5px; }
.login-title { font-size: 20px; font-weight: 700; color: var(--primary); text-align: center; margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 24px; line-height: 1.5; }
.login-btn {
  width: 100%; padding: 12px 20px; background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background 0.2s; margin-top: 4px; font-family: var(--font-body);
}
.login-btn:hover { background: var(--primary-dark); }
.login-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.login-forgot { display: block; text-align: center; margin-top: 14px; font-size: 13px; color: var(--accent); font-weight: 500; }
.login-forgot:hover { color: var(--accent-dark); text-decoration: underline; }
.login-message { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; display: none; }
.login-message.success { background: #d1fae5; color: #065f46; }
.login-message.error   { background: #fee2e2; color: #991b1b; }
.password-wrapper { position: relative; }
.toggle-password { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 13px; padding: 4px; font-family: var(--font-body); }
.toggle-password:hover { color: var(--accent); }

/* ----- Alerts ----- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: background 0.2s; text-decoration: none; font-family: var(--font-body); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); color: white; text-decoration: none; }
.btn-navy { background: var(--primary); color: white; }
.btn-navy:hover { background: var(--primary-dark); color: white; text-decoration: none; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; text-decoration: none; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ----- Badges ----- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-pending  { background: #fef3c7; color: #92400e; }

/* ----- Spinner ----- */
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Cards ----- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card-neutral {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-neutral);
  border: 1px solid var(--border);
}

/* ============================================
   ThriveHQ App-Specific Styles
   ============================================ */

/* ----- Section Headings ----- */
.section-heading,
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
}

/*
  HEADER RULES (v2.0):
  - header-inner must NEVER use flex-direction:column on any breakpoint.
  - Sign Out is ALWAYS top-right at every screen size.
  - On small screens, hide .header-version instead of stacking the header.
  - Do NOT put a 'Welcome back' heading above the membership card.
*/
.site-header {
  background: var(--primary);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header-inner { width: 100%; max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.header-left { display: flex; align-items: center; gap: 16px; }
.header-title { font-size: 20px; font-weight: 700; color: white; }
.header-back { color: rgba(255,255,255,0.8); font-size: 14px; transition: color 0.2s; }
.header-back:hover { color: white; text-decoration: none; }
.header-version { font-size: 12px; color: rgba(255,255,255,0.55); letter-spacing: 0.2px; }
.sign-out-btn {
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
  border: 1px solid rgba(255,255,255,0.3);
  white-space: nowrap;
}
.sign-out-btn:hover { background: rgba(255,255,255,0.25); color: white; }

/* ----- Layout ----- */
.main-content { max-width: 700px; margin: 0 auto; padding: 28px 20px; }
.loading { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.error { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; padding: 16px; border-radius: var(--radius-sm); margin-bottom: 24px; }

/* ----- Site Footer (gold standard v2.2) ----- */
.site-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 24px 20px 32px;
  border-top: 1px solid var(--divider);
  line-height: 1.8;
}
.site-footer a { color: var(--accent); }
.site-footer a:hover { color: var(--accent-dark); text-decoration: underline; }

/* ----- Membership Card ----- */
/*
  Gold standard v2.2: name ONLY. No email, no badge, no expires.
*/
.membership-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.membership-card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.member-name { font-size: 18px; font-weight: 700; }

/* ----- App Card Grid (portal dashboard pattern) ----- */
.app-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
}
.app-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
}
.app-section-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.app-card {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}
.app-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.app-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(13,148,136,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.app-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}
.app-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

/* ----- Resources ----- */
.resources-list { display: grid; gap: 16px; }
.resource-item {
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius);
  padding: 20px; transition: box-shadow 0.3s, transform 0.3s; display: block; box-shadow: var(--shadow);
}
.resource-item:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.resource-title { font-size: 16px; font-weight: 600; color: var(--primary); margin-bottom: 8px; }
.resource-description { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }
.resource-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent); font-weight: 600; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* ----- Account ----- */
.account-section { margin-bottom: 32px; }
.info-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  border: 2px solid var(--accent); box-shadow: var(--shadow);
}
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.info-row:last-child { border-bottom: none; }
.label { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.value { font-size: 14px; color: var(--text); font-weight: 500; }
.help-text { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.help-text a { color: var(--accent); font-weight: 600; }

/* ----- Responsive ----- */
@media (max-width: 768px) {
  /* header-inner stays flex-row — Sign Out always top-right */
  .main-content { padding: 16px; }
}

@media (max-width: 640px) {
  .header-version { display: none; }
  .header-title { font-size: 17px; }
  .membership-card { padding: 18px 16px; }
  .site-header { padding: 12px 16px; }
}

@media (max-width: 480px) {
  .app-grid { grid-template-columns: 1fr; }
  .rating-row { gap: 4px; }
  .rating-btn { width: 34px; height: 34px; font-size: 13px; }
}

@media (max-width: 390px) {
  .main-content { padding: 12px; }
}
