:root {
  --primary-color: #006696;
  --primary-hover: #005580;
  --bg-gradient-start: #f8fafc;
  --bg-gradient-end: #e2e8f0;
  --card-bg: #ffffff;
  --text-main: #334155;
  --text-secondary: #64748b;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-lg: 12px;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-main);
}

.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
  padding: 2rem;
}

.logo-section {
  margin-bottom: 2rem;
  text-align: center;
}

.portal-card {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.portal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--text-main);
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 1rem;
}

.lang-selector {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.lang-selector select {
  margin-left: 0.5rem;
  padding: 0.4rem 2rem 0.4rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background-color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1em;
}

.lang-selector select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 102, 150, 0.1);
}

.role-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.role-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0.875rem;
  background-color: var(--primary-color);
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 102, 150, 0.2);
  border: none;
  cursor: pointer;
  box-sizing: border-box;
}

.role-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 102, 150, 0.3);
  text-decoration: none;
}

.role-btn:active {
  transform: translateY(0);
}

.webcall-section {
  margin-top: 2rem;
  border-top: 1px solid #f1f5f9;
  padding-top: 1.5rem;
}

.webcall-btn img {
  border-radius: 8px;
  transition: transform 0.2s ease;
}

.webcall-btn:hover img {
  transform: scale(1.05);
}

/* Responsive */
@media (max-width: 480px) {
  .portal-card {
    padding: 1.5rem;
  }
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-main);
    background-color: #f8fafc;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 102, 150, 0.1);
}

.captcha-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.captcha-input {
    flex: 1;
}

.captcha-image-container {
    min-width: 120px;
    height: 45px;
    padding: 0 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #f1f5f9; /* Fallback */
    background-repeat: repeat; /* Mimic old table cell behavior */
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.25rem;
    letter-spacing: 4px;
    color: #1e293b;
    user-select: none;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-main);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.form-actions {
    margin-top: 1.5rem;
}

.submit-btn {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 102, 150, 0.2);
}

.submit-btn:hover {
    background-color: var(--primary-hover);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.forgot-btn {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 0.5rem;
}

/* Legacy site entry (small secondary link below submit) */
.legacy-link-wrapper {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}

.legacy-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.legacy-link:hover {
    color: var(--text-main);
    text-decoration: underline;
}
