/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Smooth transitions */
* {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
}

/* CSS Custom Properties for Theme System */
:root {
    /* Light Theme Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-primary: #4b3bff;
    --accent-secondary: #5b2ef4;
    --border-color: #e6e7eb;
    --shadow-light: rgba(0, 0, 0, 0.06);
    --shadow-medium: rgba(0, 0, 0, 0.12);
    --header-bg: rgba(255, 255, 255, 0.95);

    /* Font Settings */
    --font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-thai: 'Sarabun', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Sizing */
    --header-height: 80px;
    --border-radius: 14px;
    --input-bg: var(--bg-secondary);
    --input-focus: var(--accent-primary);
    --btn-accent: var(--accent-secondary);
    --login-max-width: 430px;
    --login-padding: 40px;
    --login-shadow: 0 8px 32px rgba(80,80,120,0.08);
    --login-shadow-dark: 0 8px 32px rgba(0,0,0,0.32);
}

[data-theme="dark"] {
    --bg-primary: #0f1720;
    --bg-secondary: #111827;
    --text-primary: #e6eef8;
    --text-secondary: #9aa6b2;
    --accent-primary: #4dabf7;
    --accent-secondary: #339af0;
    --border-color: #1f2937;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.45);
    --header-bg: rgba(10, 10, 10, 0.6);
    --input-bg: #111827;
    --input-focus: #4dabf7;
    --btn-accent: #339af0;
    --login-shadow: 0 8px 32px rgba(0,0,0,0.36);
}

/* Base */
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Thai font */
html[lang="th"] body { font-family: var(--font-thai); }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 110px; /* หรือ auto หากโลโก้สูงมาก */
    background: var(--header-bg);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.header-container {
    margin: 0px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center; /* โลโก้ซ้าย */
    position: relative;
    width: 100%;
    gap: 16px;
    padding-top: 185px;
}

/* Logo Section (Left) */
.logo-section {
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding-left: 0; /* เพิ่มระยะขอบซ้าย หรือ 0 ก็ได้ */
}

/* small spacer (keeps header centered with max-width automatically) */
.header-spacer {
    flex: 1 1 auto;
}

/* Logo styles */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.logo-image {
      margin: 0 !important;
    padding: 0 !important;
    width: 550px; /* smaller in header so it doesn't push center */
    height: auto;
    display: block;
}

/* adjust logo size for small screens */
@media (max-width: 768px) {
    .logo-image { width: 110px; }
}
@media (max-width: 480px) {
    .logo-image { width: 120px; }
    .header-container { padding: 0 5px; }
    .logo-section { padding-left: 6px; }
    .header-controls { margin-right: 6px; }
}

/* Header controls (Right) */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    margin-right: 20px;
}

/* Control Buttons */
.control-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.control-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-medium);
}

.theme-btn {
    width: 46px;
    height: 40px;
    padding: 0;
    justify-content: center;
}

.theme-icon-light, .theme-icon-dark {
    position: relative;
    transition: var(--transition);
}

/* theme icon swap */
.theme-icon-dark { opacity: 0; transform: scale(0.8); }
[data-theme="dark"] .theme-icon-light { opacity: 0; transform: scale(0.8); }
[data-theme="dark"] .theme-icon-dark { opacity: 1; transform: scale(1); }

/* Main content spacing to avoid header overlap */
.main-content { margin-top: var(--header-height); min-height: calc(100vh - var(--header-height)); }

/* Hero Section */
.hero-section {
    padding: 100px 0 80px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 14px;
    color: var(--accent-primary);
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 36px;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

/* Login Form Wrapper (centering, spacing) */
.login-form-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    max-width: var(--login-max-width);
    margin: 0 auto 32px auto;
    width: 100%;
}

/* Auth Form Styles */
.auth-form.hiai-login-form {
    width: 100%;
    max-width: var(--login-max-width);
    padding: var(--login-padding) 32px 32px 32px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--login-shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
    position: relative;
    margin: 0 auto;
}
[data-theme="dark"] .auth-form.hiai-login-form {
    background: #111827;
    box-shadow: var(--login-shadow-dark);
}
.form-header {
    text-align: center;
    margin-bottom: 0px;
}
.form-icon {
    font-size: 2.2em;
    color: var(--accent-primary);
    margin-bottom: 4px;
    margin-top: -10px;
    display: block;
}

.form-title {
    font-size: 1.37rem;
    font-weight: 800;
    color: var(--accent-primary);
    margin-bottom: 2px;
}
.form-desc {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-weight: 500;
}
.form-group {
    width: 100%;
    text-align: left;
    margin-bottom: 4px;
}
.form-label {
    display: block;
    font-size: 0.99rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-left: 2px;
}

.input-field {
    width: 100%;
    padding: 13px 16px;
    font-size: 1.08rem;
    border-radius: 9px;
    border: 1.5px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    transition: var(--transition);
    font-weight: 500;
}
.input-field:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 2px 10px var(--shadow-light);
}
.password-input {
    display: flex;
    align-items: center;
    position: relative;
}
.password-input .input-field {
    flex: 1;
}
.toggle-password {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.22em;
    z-index: 2;
    padding: 2px;
    transition: color 0.2s;
}
.toggle-password:hover {
    color: var(--accent-primary);
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.98rem;
    margin-bottom: 0;
    margin-top: 2px;
    gap: 10px;
}
.checkbox-container {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}
.checkbox-container input[type="checkbox"] {
    accent-color: var(--accent-primary);
    margin-right: 6px;
    margin-top: 0;
}
.forgot-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.01rem;
}
.forgot-link:hover {
    text-decoration: underline;
}

/* Button */
.btn {
    padding: 13px 0px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-size: 1.13rem;
    transition: var(--transition);
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}
.btn-primary {
    background: var(--accent-primary);
    color: #fff;
    margin-top: 2px;
    margin-bottom: 0;
    border-radius: 11px;
    box-shadow: 0 2px 12px var(--shadow-light);
    border: 0.5px solid var(--accent-primary);
    font-weight: 700;
    letter-spacing: 0.01em;
}
.btn-primary:hover {
    background: var(--accent-secondary);
    color: #fff;
    box-shadow: 0 4px 18px var(--shadow-medium);
    transform: translateY(-2px);
}
.btn-google {
    background: #fff;
    border: 1.5px solid var(--border-color);
    color: #212529;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.07rem;
    margin-top: 2px;
    margin-bottom: 0;
    border-radius: 9px;
    box-shadow: 0 1px 6px var(--shadow-light);
    transition: var(--transition);
    min-height: 48px;
    letter-spacing: 0.01em;
}
.btn-google:hover {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 2px 10px var(--shadow-medium);
}
.google-logo {
    height: 26px;
    width: 26px;
    margin-right: 4px;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 1.03rem;
    margin: 19px 0 10px 0;
    font-weight: 600;
}
.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1.5px;
    background: var(--border-color);
    border-radius: 2px;
}
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 1.02rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.auth-footer a {
    color: var(--accent-primary);
    margin-left: 7px;
    font-weight: 700;
    text-decoration: none;
    font-size: 1.03rem;
}
.auth-footer a:hover {
    text-decoration: underline;
}

/* Utility */
.w-100 {
    width: 100%;
}

/* Hero Buttons */
.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
    max-width: var(--login-max-width);
    margin-left: auto;
    margin-right: auto;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    font-weight: 700;
    border-radius: 10px;
    font-size: 1.09rem;
}
.btn-secondary:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
    box-shadow: 0 2px 12px var(--shadow-light);
}

/* Features Section - ใหม่ ใหญ่ เรียงหน้ากระดาน ไอคอนสวย */
.features-section {
    padding: 80px 0 70px 0;
    background: var(--bg-primary);
}
.section-title {
    text-align: center;
    font-size: 2.45rem;
    font-weight: 900;
    margin-bottom: 48px;
    color: var(--accent-primary);
    letter-spacing: 0.01em;
}
.features-grid {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 36px;
    max-width: 1080px;
    margin: 0 auto;
    flex-wrap: wrap;
}
.feature-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 4px 28px var(--shadow-light);
    padding: 48px 34px 36px 34px;
    flex: 1 1 300px;
    max-width: 350px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
    transition: box-shadow 0.25s, transform 0.18s;
    border: 1.5px solid var(--border-color);
}
[data-theme="dark"] .feature-card {
    background: #18202b;
    box-shadow: 0 8px 34px var(--shadow-medium);
    border-color: #232c39;
}
.feature-card:hover {
    box-shadow: 0 10px 40px var(--accent-primary);
    transform: translateY(-6px) scale(1.03);
}
.feature-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary) 60%, var(--accent-secondary) 100%);
    box-shadow: 0 6px 20px var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 28px;
    margin-top: 2px;
    transition: background 0.3s, box-shadow 0.3s;
}
.feature-icon.accent1 { background: linear-gradient(135deg,#4b3bff 60%,#35d2ff 100%); box-shadow: 0 6px 20px #35d2ff33;}
.feature-icon.accent2 { background: linear-gradient(135deg,#4b3bff 60%,#29c19a 100%); box-shadow: 0 6px 20px #29c19a33;}
.feature-icon.accent3 { background: linear-gradient(135deg,#4b3bff 60%,#ffb25b 100%); box-shadow: 0 6px 20px #ffb25b33;}

.feature-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--accent-primary);
    margin-bottom: 14px;
    text-align: center;
    letter-spacing: 0.01em;
}
.feature-description {
    font-size: 1.09rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0;
    font-weight: 500;
    line-height: 1.6;
}

/* Responsive Features */
@media (max-width: 1080px) {
    .features-grid { gap: 22px; }
    .feature-card { max-width: 330px; }
}
@media (max-width: 900px) {
    .features-grid { flex-wrap: wrap; gap: 18px; }
    .feature-card { padding: 38px 18px 30px 18px; }
}
@media (max-width: 700px) {
    .features-grid { flex-direction: column; align-items: center; }
    .feature-card { max-width: 95vw; min-width: 0; }
}
@media (max-width: 480px) {
    .features-section { padding: 50px 0 35px 0; }
    .section-title { font-size: 1.35rem; }
    .feature-card { padding: 24px 7vw 20px 7vw; }
    .feature-icon { width: 55px; height: 55px; font-size: 1.7rem; }
    .feature-title { font-size: 1.02rem; margin-bottom: 9px; }
    .feature-description { font-size: 0.97rem; }
}
.auth-container {
    padding-left: 24px;
    padding-right: 24px;
}
.auth-header h1, .auth-header p {
    padding-left: 2px;
}
.auth-form label,
.form-hint {
    padding-left: 2px;
}
@media (max-width: 600px) {
    .auth-container {
        padding-left: 12px;
        padding-right: 12px;
    }
}

.pill.status-active {
  background: #17a26922;
  color: #18b26b;
}
.pill.status-locked {
  background: #e5535322;
  color: #e55353;
}