/* ===== Texas Health Resources MyChart Clone — Main Styles ===== */
/* Matches real Epic MyChart design system: colors, spacing, fonts, responsive breakpoints */

:root {
  --primary: #003798;
  --primary-dark: #002a75;
  --primary-light: #0049b3;
  --accent: #0072C6;
  --accent-light: #4a9eff;
  --error: #d80000;
  --error-bg: #f8dedd;
  --success: #009041;
  --success-bg: #ebf7f0;
  --gray-100: #f2f2f2;
  --gray-200: #dbdbdb;
  --gray-300: #cccccc;
  --gray-400: #767676;
  --gray-500: #565656;
  --gray-600: #363636;
  --white: #ffffff;
  --black: #000000;
  --shadow: rgba(0, 0, 0, 0.1);
  --radius: 20px;
  --font: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  color: var(--gray-600);
  background: var(--white);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Cloudflare Challenge Page ===== */
.cf-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f9f9f9;
}
.cf-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
  padding: 3rem 2.5rem;
  max-width: 480px;
  width: 90%;
  text-align: center;
}
.cf-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cf-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}
.cf-text {
  font-size: 0.9rem;
  color: var(--gray-400);
  margin-bottom: 0.3rem;
}
.cf-ray-id {
  font-size: 0.75rem;
  color: var(--gray-300);
  margin-top: 1.5rem;
  font-family: monospace;
}
.cf-captcha-wrap {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}
.cf-captcha {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: 6px;
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  color: var(--gray-500);
  user-select: none;
}
.cf-captcha:hover { border-color: var(--accent); }
.cf-captcha.verified {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
  cursor: default;
}
.cf-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-300);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: all 0.2s;
}
.cf-captcha.verified .cf-checkbox {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
}

/* ===== Main Layout (Two Column on Desktop) ===== */
.page-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#content {
  display: flex;
  flex: 1;
  border-radius: 0;
  overflow: hidden;
}

@media (min-width: 1300px) {
  #content {
    border-radius: var(--radius);
    max-width: 1400px;
    margin: 2rem auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    min-height: 700px;
  }
}

/* Left sidebar — city image + hospital branding */
#sidebar {
  display: none;
  flex: 1.2;
  background: linear-gradient(135deg, #003798 0%, #0057b3 100%);
  position: relative;
  overflow: hidden;
}
#sidebar .city-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  opacity: 0.15;
  background: url('../img/city-skyline.svg') no-repeat bottom center;
  background-size: cover;
}
#sidebar .sidebar-content {
  position: relative;
  z-index: 1;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--white);
  text-align: center;
}
#sidebar .sidebar-content h1 {
  font-size: 2rem;
  font-weight: 300;
  margin-bottom: 1rem;
}
#sidebar .sidebar-content p {
  font-size: 1rem;
  opacity: 0.85;
  max-width: 300px;
  line-height: 1.6;
}

@media (min-width: 1300px) {
  #sidebar { display: flex; }
}

/* Right side — login form */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 3rem;
  background: rgba(255,255,255,0.9);
}
@media (max-width: 1299px) {
  #main { padding: 2rem 1.5rem; }
}

/* Logo area */
.logo-link {
  display: inline-block;
  margin-bottom: 2rem;
}
.logo-svg {
  height: 40px;
  width: auto;
}

/* Login header */
.login-header {
  margin-bottom: 2rem;
}
.login-header h2 {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--gray-500);
}
.login-header h2 strong {
  font-weight: 600;
  color: var(--gray-600);
}

/* ===== Form Styles ===== */
.form-group {
  margin-bottom: 1.2rem;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.3rem;
}
.form-group .field-wrap {
  position: relative;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"] {
  width: 100%;
  padding: 0.7rem 0.75rem;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--gray-600);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 114, 198, 0.15);
}
.form-group input.error {
  border-color: var(--error);
}
.form-group .error-text {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: none;
}
.form-group.has-error .error-text { display: block; }

/* Checkbox / remember me */
.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1.2rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}
.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  text-decoration: none;
  width: 100%;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--primary-dark);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-link {
  background: none;
  color: var(--accent);
  font-weight: 400;
  padding: 0.3rem 0;
  width: auto;
}
.btn-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Error banner */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 1.2rem;
  font-size: 0.875rem;
}
.alert-banner.error {
  background: var(--error-bg);
  color: var(--error);
}
.alert-banner.success {
  background: var(--success-bg);
  color: var(--success);
}
.alert-banner .icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}
.alert-banner.hidden { display: none; }

/* Links row */
.links-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 1.2rem;
  gap: 0.5rem;
}
.links-row a {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}
.links-row a:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

/* Pay as guest link */
.pay-guest-row {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
  text-align: center;
}
.pay-guest-row a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}
.pay-guest-row a:hover {
  text-decoration: underline;
}

/* ===== Security Check (2FA) Page ===== */
.code-input-wrap {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.5rem 0;
}
.code-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font);
  border: 2px solid var(--gray-300);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}
.code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 114, 198, 0.15);
}
.code-input.filled {
  border-color: var(--primary);
}
.try-count {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 1rem;
}

/* ===== Dashboard Shell ===== */
.dash-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.dash-header .logo-svg { height: 28px; }
.dash-header .user-info {
  font-size: 0.85rem;
  color: var(--gray-500);
}
.dash-tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  padding: 0 2rem;
  overflow-x: auto;
}
.dash-tab {
  padding: 0.9rem 1.2rem;
  font-size: 0.875rem;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}
.dash-tab:hover { color: var(--primary); }
.dash-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.dash-content {
  flex: 1;
  padding: 2rem;
  background: #fafafa;
}
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--gray-400);
}
.dash-empty .icon-big {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}
.dash-empty h3 {
  font-size: 1.1rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}
.dash-empty p {
  font-size: 0.9rem;
  max-width: 400px;
}

/* Session timeout modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: 12px;
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-box h3 {
  font-size: 1.2rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}
.modal-box p {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.modal-box .btn { width: auto; padding: 0.7rem 2.5rem; }

/* ===== Forgot Password Multi-Step ===== */
.step-indicator {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-300);
  transition: background 0.3s;
}
.step-dot.active { background: var(--primary); }
.step-dot.done { background: var(--success); }

.forgot-step {
  display: none;
}
.forgot-step.active { display: block; }

/* ===== Call Support Page ===== */
.support-card {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 500px;
  margin: 0 auto;
}
.support-card .phone-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1rem 0;
  letter-spacing: 1px;
}
.support-card .wait-text {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

/* ===== Live Chat Widget ===== */
#chatToggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 30px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  z-index: 2000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: background 0.2s;
}
#chatToggle:hover { background: var(--primary-dark); }

#chatWidget {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 360px;
  max-height: 500px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 2001;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#chatWidget.open { display: flex; }
.chat-header {
  background: var(--primary);
  color: var(--white);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
}
.chat-close {
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.8;
}
.chat-close:hover { opacity: 1; }
.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 250px;
}
.chat-msg {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
  animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg.agent {
  background: #f0f4ff;
  color: var(--gray-600);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  background: var(--primary);
  color: var(--white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg strong { color: var(--primary); }
.chat-typing {
  display: none;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.9rem;
  max-width: 60%;
  border-radius: 10px;
  background: #f0f4ff;
  align-self: flex-start;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  background: var(--gray-400);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

/* ===== Loading Spinner (Epic-style blue circle) ===== */
.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.epic-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 55, 152, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-text {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* ===== Footer ===== */
#footer {
  text-align: center;
  padding: 1rem 2rem;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}
#footer .epic-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--gray-400);
}
#footer .epic-credit img {
  height: 20px;
  opacity: 0.6;
}
#footer .epic-credit a {
  color: var(--gray-400);
  text-decoration: none;
}
#footer .epic-credit a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 1299px) {
  #main {
    padding: 2rem 1.5rem;
    background: var(--white);
  }
  .login-header h2 { font-size: 1rem; }
  .code-input { width: 42px; height: 48px; font-size: 1.3rem; }
  #chatWidget { width: 320px; right: 1rem; }
}

@media (max-width: 480px) {
  #main { padding: 1.5rem 1rem; }
  .dash-tabs { padding: 0 1rem; }
  .dash-tab { padding: 0.7rem 0.9rem; font-size: 0.8rem; }
  .dash-content { padding: 1rem; }
  .code-input { width: 38px; height: 44px; font-size: 1.1rem; }
  #chatWidget { width: 300px; right: 0.5rem; bottom: 4.5rem; }
  .support-card .phone-number { font-size: 1.4rem; }
}

/* ===== Hidden utility ===== */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}