/* ============================================
   HelpClaude Client Portal - Shared Stylesheet
   ============================================ */

/* --- Custom Properties --- */
:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #3b82f6;
  --color-primary-bg: #eff6ff;
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-warning: #d97706;
  --color-warning-bg: #fffbeb;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-bg: #f8fafc;
  --color-white: #ffffff;
  --color-border: #e2e8f0;
  --color-border-focus: #93c5fd;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Layout --- */
.page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  width: 100%;
}

.container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.container--wide {
  max-width: 680px;
}

/* --- Header --- */
.header {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}

.header__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-md);
}

.header__logo svg {
  width: 32px;
  height: 32px;
  fill: var(--color-white);
}

.header__brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.header__title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header__subtitle {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-top: 0.5rem;
}

/* --- Card --- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  padding: 1.75rem;
  animation: fadeInUp var(--transition-slow) ease-out;
}

.card + .card {
  margin-top: 1rem;
}

.card__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1rem;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-of-type {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.375rem;
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-input:invalid:not(:placeholder-shown) {
  border-color: var(--color-danger);
}

.form-input--error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-error {
  font-size: 0.8125rem;
  color: var(--color-danger);
  margin-top: 0.375rem;
  display: none;
}

.form-error.visible {
  display: block;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8125rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  line-height: 1.25;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  width: 100%;
  color: var(--color-white);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--color-white);
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn--secondary {
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1.5px solid var(--color-primary);
}

.btn--secondary:hover {
  background: var(--color-primary);
  color: var(--color-white);
  text-decoration: none;
}

.btn--outline {
  color: var(--color-text-secondary);
  background: transparent;
  border: 1.5px solid var(--color-border);
}

.btn--outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  text-decoration: none;
}

.btn--small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* --- Code Display Box --- */
.code-box {
  position: relative;
  background: var(--color-text);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  margin: 1rem 0;
}

.code-box__value {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: 0.25em;
  user-select: all;
  -webkit-user-select: all;
  line-height: 1.2;
  word-break: break-all;
}

.code-box__copy {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-white);
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.code-box__copy:hover {
  background: rgba(255, 255, 255, 0.25);
}

.code-box__copy.copied {
  background: var(--color-success);
}

/* --- Timer --- */
.timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 1rem 0;
}

.timer--active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.timer--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.timer--expired {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.timer__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

/* --- QR Code --- */
.qr-container {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}

.qr-container canvas,
.qr-container img,
.qr-container table {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* --- Steps (aide page) --- */
.steps {
  list-style: none;
  counter-reset: step-counter;
}

.step {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
  animation: fadeInUp var(--transition-slow) ease-out both;
}

.step:last-child {
  border-bottom: none;
}

.step:nth-child(1) { animation-delay: 0ms; }
.step:nth-child(2) { animation-delay: 80ms; }
.step:nth-child(3) { animation-delay: 160ms; }
.step:nth-child(4) { animation-delay: 240ms; }
.step:nth-child(5) { animation-delay: 320ms; }

.step__number {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--color-white);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.step__content {
  flex: 1;
  padding-top: 0.375rem;
}

.step__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.step__desc {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* --- FAQ --- */
.faq-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item__question {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.faq-item__question::before {
  content: "Q";
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.faq-item__answer {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  padding-left: 2rem;
}

/* --- Alert / Notice --- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
}

.notice--info {
  background: var(--color-primary-bg);
  color: var(--color-primary-dark);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.notice--warning {
  background: var(--color-warning-bg);
  color: #92400e;
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.notice--success {
  background: var(--color-success-bg);
  color: #166534;
  border: 1px solid rgba(22, 163, 74, 0.2);
}

.notice__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.footer a {
  color: var(--color-text-secondary);
}

.footer a:hover {
  color: var(--color-primary);
}

/* --- Navigation --- */
.nav-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--color-text-secondary);
}

.nav-links a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--dark {
  border-color: rgba(37, 99, 235, 0.2);
  border-top-color: var(--color-primary);
}

/* --- Divider --- */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-secondary { color: var(--color-text-secondary); }
.text-small { font-size: 0.8125rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- Responsive: Tablet+ --- */
@media (min-width: 480px) {
  .page-wrapper {
    padding: 1.5rem;
  }

  .header {
    padding: 2.5rem 1rem 2rem;
  }

  .header__title {
    font-size: 1.75rem;
  }

  .card {
    padding: 2rem;
  }

  .code-box__value {
    font-size: 3rem;
  }
}

@media (min-width: 768px) {
  .page-wrapper {
    padding: 2rem;
  }

  .header {
    padding: 3rem 1rem 2rem;
  }

  .header__logo {
    width: 64px;
    height: 64px;
  }

  .header__logo svg {
    width: 36px;
    height: 36px;
  }

  .header__title {
    font-size: 2rem;
  }

  .card {
    padding: 2.25rem;
  }
}

/* --- Print --- */
@media print {
  body {
    background: white;
  }

  .header__logo,
  .footer,
  .nav-links,
  .btn {
    display: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
