/* ============================================
   Coach4U Shared Design System — css/style.css
   Version: 2.2
   Changelog:
     1.0 - Initial shared design system
     1.1 - Added login page pattern (.login-page, .login-card etc)
     1.2 - Aligned brand variables to templates/PROFILE.md
           (Inter + Montserrat, navy #1B3664, accent blue #5684C4,
           body text #2D2D2D)
     2.0 - Adopted dashboard design as standard
           (Aptos system stack, navy #003366, teal #0D9488,
           white background, teal-bordered cards)
     2.1 - Added app card grid pattern (.app-grid, .app-card etc)
           Standard portal dashboard layout for all Coach4U apps.
     2.2 - Added .site-footer for canonical dashboard footer.
           Membership card: name only (no email, badge, or expires).
   ============================================ */

/*
  No external fonts required — uses the Aptos system font stack:
  'Aptos', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif
*/

/* ----- CSS Variables ----- */
: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 */

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

  /* 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-lg:      0 6px 16px rgba(13,148,136,0.22);
  --shadow-neutral: 0 2px 8px rgba(0,0,0,0.07);
}

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

/*
  IMPORTANT: Do NOT add display:flex or flex-direction:column to body.
  Auth pages (login, forgot-password, reset-password) use their own
  body layout to centre the card.
*/
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ----- 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 img { margin: 0 auto 12px; }
.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); margin-bottom: 6px; text-align: center; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; text-align: center; }
.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: #D4EDDA; color: #155724; }
.login-message.error   { background: #F8D7DA; color: #721C24; }
.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; }
.toggle-password:hover { color: var(--accent); }

/* ----- Header ----- */
/*
  Sign Out is ALWAYS top-right of the header across all apps.
  header-inner must NEVER use flex-direction:column.
*/
.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: 24px; font-weight: 700; color: white; letter-spacing: -0.5px; }
.header-back { color: rgba(255,255,255,0.7); font-size: 13px; transition: color 0.2s; }
.header-back:hover { color: white; text-decoration: none; }
.header-version { font-size: 12px; color: rgba(255,255,255,0.55); }
.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);
}
.sign-out-btn:hover { background: rgba(255,255,255,0.25); color: white; }

/* ----- Layout ----- */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 20px; }
.page-title { font-size: 28px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

/* ----- Section Headings ----- */
.section-heading {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--primary); margin: 32px 0 12px; padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
  display: flex; justify-content: space-between; align-items: center;
}

/* ----- 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 h2, .card h3 { color: var(--primary); margin-bottom: 8px; font-size: 16px; font-weight: 600; }
.card p { color: var(--text-muted); font-size: 13px; }

.card-neutral {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-neutral); border: 1px solid var(--border);
}

/* ----- 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(3, 1fr);
  gap: 20px;
  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;
}

/* ----- About Panel ----- */
.about-panel {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius); padding: 20px 24px; margin-bottom: 32px;
  color: white; position: relative; overflow: hidden;
}
.about-panel::after {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.about-panel-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.about-version { font-size: 11px; font-weight: 600; background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 20px; letter-spacing: 0.4px; }
.about-panel-desc  { font-size: 13px; opacity: 0.9; line-height: 1.6; margin-bottom: 14px; max-width: 700px; }
.about-panel-tags  { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1; }
.about-panel-tag {
  font-size: 11px; font-weight: 600; background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 20px;
  padding: 4px 12px; color: white; display: inline-block;
  transition: background 0.2s; text-decoration: none;
}
.about-panel-tag:hover { background: rgba(255,255,255,0.3); color: white; text-decoration: none; }

/* ----- 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: 24px;
  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%; }
.membership-card .member-name { font-size: 18px; font-weight: 700; }

/* ----- 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; }
.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; }

/* ----- 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; }

/* ----- 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; }
.error-msg   { color: #c62828; font-size: 13px; margin-top: 12px; text-align: center; }
.success-msg { color: var(--accent); font-size: 13px; margin-top: 10px; font-weight: 500; }

/* ----- 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: #e6f4f1; color: var(--accent); }
.badge-inactive { background: #fce8e8; color: #c62828; }
.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: white; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Resources ----- */
.resources-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.resource-item {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  border: 2px solid var(--accent); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.resource-item:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

/* ----- Account ----- */
.account-section { margin-bottom: 32px; }
.account-section h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--primary); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); }
.account-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--divider); font-size: 13px; }
.account-row .key { color: var(--text-muted); font-weight: 500; }
.account-row .val { color: var(--text); font-weight: 600; }

/* ----- 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; }

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .container { padding: 20px 16px; }
  .card-grid, .resources-grid { grid-template-columns: 1fr; }
  .site-header { padding: 12px 16px; }
  .header-title { font-size: 17px; }
  .header-version { display: none; }
  .btn { font-size: 13px; padding: 8px 14px; }
  .membership-card { padding: 18px 16px; }
  .login-card { padding: 28px 18px; }
}

@media (max-width: 820px) {
  .app-grid { grid-template-columns: repeat(2, 1fr); }
}

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

@media (max-width: 400px) {
  .app-card { padding: 16px; }
}
