/* =========================================================
   member.css
   ระบบสมัครสมาชิกออนไลน์
   ใช้เฉพาะ:
   - หน้าเลือกประเภทใบสมัคร public/index.php
   - หน้ากรอกใบสมัคร step-1 ถึง step-6
   - review / confirm / download flow
   ตัด CSS เดิมที่เป็น profile, course, dashboard, registration ออกแล้ว
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root {
    --coop-primary: #10b981;
    --coop-primary-dark: #047857;
    --coop-primary-soft: #ecfdf5;

    --coop-blue: #2563eb;
    --coop-blue-soft: #dbeafe;

    --coop-dark: #0f172a;
    --coop-text: #334155;
    --coop-muted: #64748b;
    --coop-border: #e2e8f0;
    --coop-bg: #f7f8fa;

    --shadow-card: 0 8px 22px rgba(15, 23, 42, 0.045);
    --shadow-hover: 0 14px 28px rgba(15, 23, 42, 0.075);

    --radius-card: 16px;
    --radius-input: 10px;
}

/* ---------- Base ---------- */
html {
    width: 100%;
    max-width: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
    background: var(--coop-bg);
    color: var(--coop-text);
    font-size: 14px;
    line-height: 1.65;
    font-family: "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

img,
svg {
    max-width: 100%;
}

a,
button,
.form-control,
.form-select,
.coop-card,
.coop-btn-primary,
.coop-btn-outline,
.me-type-card,
.me-start-link,
.member-step-item {
    transition:
        background-color .18s ease,
        border-color .18s ease,
        color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

/* =========================================================
   Landing Page: public/index.php
   ========================================================= */

.me-body {
    min-height: 100vh;
    background: var(--coop-bg) !important;
    color: var(--coop-dark);
}

/* Header */
.me-header {
    width: 100%;
    min-height: 50px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.me-header-inner {
    max-width: 960px;
    min-height: 50px;
    margin: 0 auto;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.me-logo {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: fit-content;
    color: var(--coop-dark);
    text-decoration: none !important;
}

.me-coop-logo {
    width: 28px !important;
    height: 28px !important;
    object-fit: contain !important;
    display: block !important;
    flex-shrink: 0;
}

.me-logo-img {
    height: 24px !important;
    width: auto;
    display: block;
}

.me-logo-text,
.me-logo-fallback {
    display: inline-flex;
    align-items: center;
    color: var(--coop-dark);
    font-size: 18px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.me-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 26px;
}

.me-nav a {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    color: var(--coop-muted);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 400;
    border-bottom: 2px solid transparent;
}

.me-nav a:hover,
.me-nav a.active {
    color: var(--coop-primary);
    border-bottom-color: var(--coop-primary);
}

.me-fullscreen-btn {
    justify-self: end;
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.me-fullscreen-btn:hover {
    background: #f1f5f9;
}

.me-fullscreen-btn img {
    width: 15px;
    height: 15px;
    opacity: .75;
    object-fit: contain;
}

/* Main landing layout */
.me-main {
    min-height: auto;
    padding: 34px 16px 32px;
}

.me-hero {
    text-align: center;
    margin-bottom: 28px;
}

.me-hero h1 {
    margin: 0;
    color: var(--coop-dark);
    font-size: 28px;
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.me-hero p {
    margin: 8px 0 0;
    color: #475569;
    font-size: 14px;
    font-weight: 400;
}

/* Application box */
.me-application-box {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e3e8ef;
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 28px 30px;
}

.me-box-head {
    text-align: center;
    margin-bottom: 24px;
}

.me-box-head h2 {
    margin: 0 0 7px;
    color: var(--coop-dark);
    font-size: 21px;
    line-height: 1.3;
    font-weight: 500;
}

.me-box-head p {
    max-width: 460px;
    margin: 0 auto;
    color: var(--coop-muted);
    font-size: 12.5px;
    line-height: 1.55;
}

/* Member type cards */
.me-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.me-type-card {
    min-height: 220px;
    background: #ffffff;
    border: 1px solid #dfe4ea;
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
}

.me-type-card:hover {
    transform: translateY(-4px);
    border-color: #cbd5e1;
    box-shadow: var(--shadow-hover);
}

.me-type-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.me-type-icon img {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    object-fit: contain;
}

.me-green-icon {
    background: #dcfce7;
    color: #16a34a;
}

.me-blue-icon {
    background: #dbeafe;
    color: var(--coop-blue);
}

.me-type-card h3 {
    margin: 0 0 2px;
    color: var(--coop-dark);
    font-size: 16px;
    line-height: 1.35;
    font-weight: 500;
}

.me-type-label {
    margin-bottom: 12px;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: .035em;
}

.me-green-text {
    color: #16a34a;
}

.me-blue-text {
    color: var(--coop-blue);
}

.me-type-card p {
    margin: 0;
    min-height: 56px;
    color: #475569;
    font-size: 12.5px;
    line-height: 1.6;
}

.me-start-link {
    margin-top: auto;
    width: 100%;
    min-height: 36px;
    border: 1px solid #dfe4ea;
    border-radius: 7px;
    background: #f8fafc;
    color: var(--coop-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 500;
}

.me-start-link:hover {
    background: var(--coop-primary);
    border-color: var(--coop-primary);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Steps on landing */
.me-steps-section {
    max-width: 700px;
    margin: 36px auto 0;
}

.me-section-line {
    height: 1px;
    background: #dfe4ea;
    margin-bottom: 24px;
}

.me-steps-section h2 {
    margin: 0 0 22px;
    color: var(--coop-dark);
    text-align: center;
    font-size: 16px;
    font-weight: 500;
}

.me-steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 26px;
}

.me-step-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: flex-start;
    gap: 10px;
}

.me-step-item span {
    width: 23px;
    height: 23px;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
}

.me-step-item strong {
    display: block;
    color: var(--coop-dark);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
}

.me-step-item small {
    display: block;
    color: var(--coop-muted);
    font-size: 11px;
    line-height: 1.4;
    margin-top: 3px;
}

/* Text-only footer */
.me-simple-footer {
    width: 100%;
    padding: 16px 12px 22px !important;
    margin: 0 auto !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    text-align: center !important;
    color: var(--coop-muted) !important;
    font-size: 12px !important;
    line-height: 1.6 !important;
    font-weight: 400 !important;
}

.me-footer,
footer.me-footer {
    display: none !important;
}

/* Floating help button */
.me-help-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 30;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #4f46e5;
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.me-help-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(79, 70, 229, 0.34);
}

.me-help-btn img {
    width: 19px;
    height: 19px;
    filter: brightness(0) invert(1);
    object-fit: contain;
}

/* Landing animation */
.me-fade-up {
    opacity: 0;
    transform: translateY(14px);
    animation: meFadeUp .55s ease forwards;
}

.me-delay-1 {
    animation-delay: .08s;
}

.me-delay-2 {
    animation-delay: .16s;
}

@keyframes meFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   Application Form Pages
   step-1.php ถึง step-6.php / review.php
   ========================================================= */

.app-layout {
    width: 100%;
    min-height: 100vh;
}

.app-main {
    width: 100% !important;
    min-height: 100vh;
    margin-left: 0 !important;
    padding: 0 24px 40px !important;
}

.app-topbar {
    max-width: 1120px !important;
    width: 100% !important;
    min-height: 74px;
    margin: 20px auto 18px !important;
    padding: 18px 22px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;

    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 18px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05) !important;
    position: relative !important;
    top: auto !important;
}

.app-topbar > div:first-child {
    min-width: 0 !important;
}

.page-title {
    margin: 0;
    color: var(--coop-dark) !important;
    font-size: 24px !important;
    line-height: 1.3 !important;
    font-weight: 500 !important;
}

.page-subtitle {
    margin: 5px 0 0 !important;
    color: var(--coop-muted) !important;
    font-size: 13.5px !important;
    line-height: 1.55 !important;
    font-weight: 400 !important;
}

.app-content {
    max-width: 1120px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 0 32px !important;
}

/* ---------- Cards ---------- */
.coop-card {
    background: #ffffff !important;
    border: 1px solid var(--coop-border) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card) !important;
}

.coop-card:hover {
    box-shadow: var(--shadow-card) !important;
}

form.coop-card.p-4,
section.coop-card.p-4,
.coop-card.p-4 {
    padding: 24px !important;
}

.app-content h4 {
    margin: 0;
    color: var(--coop-dark);
    font-size: 19px !important;
    line-height: 1.4;
    font-weight: 500 !important;
}

.app-content h5 {
    color: var(--coop-dark);
    font-size: 16px !important;
    line-height: 1.45;
    font-weight: 500 !important;
}

.text-muted {
    color: var(--coop-muted) !important;
}

/* ---------- Form ---------- */
.form-label {
    margin-bottom: 7px;
    color: #334155 !important;
    font-size: 13.5px !important;
    font-weight: 400 !important;
}

.form-control,
.form-select {
    min-height: 42px !important;
    height: 42px !important;
    border: 1px solid #dbe3ea !important;
    border-radius: var(--radius-input) !important;
    background-color: #ffffff !important;
    color: var(--coop-dark) !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    padding: 8px 12px !important;
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--coop-primary) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12) !important;
}

textarea.form-control {
    height: auto !important;
    min-height: 100px !important;
    resize: vertical;
}

.form-text {
    color: var(--coop-muted);
    font-size: 12px !important;
}

/* Radio / checkbox cards */
label.border.rounded-4 {
    min-height: 54px;
    border-color: #dbe3ea !important;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
    font-size: 14px;
    font-weight: 400 !important;
}

label.border.rounded-4:hover {
    border-color: var(--coop-primary) !important;
    background: var(--coop-primary-soft);
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--coop-primary);
}

/* ---------- Buttons ---------- */
.coop-btn-primary,
.coop-btn-outline {
    min-height: 40px !important;
    border-radius: 10px !important;
    padding: 8px 16px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none !important;
}

.coop-btn-primary {
    background: var(--coop-primary) !important;
    border: 1px solid var(--coop-primary) !important;
    color: #ffffff !important;
}

.coop-btn-primary:hover {
    background: #059669 !important;
    border-color: #059669 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.coop-btn-outline {
    background: #ffffff !important;
    border: 1px solid #dbe3ea !important;
    color: #334155 !important;
}

.coop-btn-outline:hover {
    background: var(--coop-primary-soft) !important;
    border-color: var(--coop-primary) !important;
    color: var(--coop-primary-dark) !important;
}

/* ---------- Badges ---------- */
.coop-badge-success,
.coop-badge-warning,
.coop-badge-danger,
.coop-badge-secondary {
    min-height: 28px;
    border-radius: 999px;
    padding: 5px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.coop-badge-success {
    background: #dcfce7;
    color: #166534;
}

.coop-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.coop-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.coop-badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

/* ---------- Alerts ---------- */
.alert {
    border-radius: 14px !important;
    border-width: 1px !important;
    padding: 14px 16px !important;
    font-size: 14px;
    line-height: 1.6;
}

/* ---------- Tables ---------- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-clean {
    margin-bottom: 0;
}

.table-clean th {
    background: #f8fafc;
    color: var(--coop-muted);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}

.table-clean td {
    color: var(--coop-dark);
    font-size: 14px;
    vertical-align: middle;
}

/* ---------- Utility fixes ---------- */
.row.g-3 {
    --bs-gutter-x: 16px !important;
    --bs-gutter-y: 14px !important;
}

hr {
    margin: 22px 0 !important;
    border-color: var(--coop-border) !important;
}

.border.rounded-4.p-3,
.border.rounded-4.p-3.p-md-4 {
    border-radius: 14px !important;
}

.beneficiary-section {
    border-color: var(--coop-border) !important;
}

/* =========================================================
   Form Stepper: app/Includes/stepper.php
   Desktop = แนวนอน 6 ช่อง
   Mobile = แนวนอน แล้วตัดบรรทัดใหม่
   ========================================================= */

.member-stepper-card {
    padding: 14px 18px !important;
    border-radius: 18px !important;
    overflow: visible !important;
    margin-bottom: 18px !important;
}

.member-steps {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    overflow: visible !important;
    padding: 0 !important;
}

.member-step-item {
    flex: 0 1 auto !important;
    min-width: auto !important;
    max-width: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    border-radius: 999px !important;
    background: transparent !important;
}

.member-step-number {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 999px !important;
    background: #f1f5f9 !important;
    color: #334155 !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    font-size: 13px !important;
    font-weight: 500 !important;
}

.member-step-title {
    color: var(--coop-muted) !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    white-space: nowrap !important;
}

.member-step-item.active {
    background: var(--coop-primary-soft) !important;
}

.member-step-item.active .member-step-number {
    background: #bbf7d0 !important;
    color: var(--coop-primary-dark) !important;
}

.member-step-item.active .member-step-title {
    color: var(--coop-dark) !important;
    font-weight: 500 !important;
}

.member-step-item.done .member-step-number {
    background: #e2e8f0 !important;
    color: #334155 !important;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (min-width: 901px) and (max-height: 820px) {
    .me-main {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .me-hero {
        margin-bottom: 20px;
    }

    .me-hero h1 {
        font-size: 25px;
    }

    .me-application-box {
        max-width: 660px;
        padding: 22px 26px;
    }

    .me-box-head {
        margin-bottom: 18px;
    }

    .me-type-card {
        min-height: 198px;
        padding: 16px;
    }

    .me-type-icon {
        width: 34px;
        height: 34px;
        margin-bottom: 16px;
    }

    .me-type-icon img {
        width: 18px !important;
        height: 18px !important;
    }

    .me-type-card p {
        min-height: 48px;
        font-size: 12px;
        line-height: 1.5;
    }

    .me-start-link {
        min-height: 34px;
    }

    .me-steps-section {
        max-width: 660px;
        margin-top: 28px;
    }

    .me-section-line {
        margin-bottom: 18px;
    }

    .me-steps-section h2 {
        margin-bottom: 16px;
    }

    .me-steps-grid {
        gap: 12px 22px;
    }
}

@media (max-width: 992px) {
    .app-main {
        padding: 0 16px 32px !important;
    }

    .app-topbar,
    .app-content {
        max-width: 100% !important;
    }

    .app-topbar {
        margin: 14px auto !important;
        padding: 16px !important;
    }

    form.coop-card.p-4,
    section.coop-card.p-4,
    .coop-card.p-4 {
        padding: 20px !important;
    }
}

@media (max-width: 720px) {
    .me-header {
        min-height: 58px;
    }

    .me-header-inner {
        min-height: 58px;
        grid-template-columns: 1fr auto;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .me-nav {
        order: 3;
        grid-column: 1 / -1;
        justify-content: center;
        gap: 24px;
    }

    .me-nav a {
        min-height: 36px;
    }

    .me-main {
        padding: 24px 12px 32px;
    }

    .me-hero {
        margin-bottom: 24px;
    }

    .me-hero h1 {
        font-size: 23px;
    }

    .me-hero p {
        font-size: 13px;
    }

    .me-application-box {
        max-width: 100%;
        padding: 22px 14px 16px;
    }

    .me-box-head h2 {
        font-size: 20px;
    }

    .me-type-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .me-type-card {
        min-height: auto;
        padding: 16px;
    }

    .me-type-icon {
        margin-bottom: 14px;
    }

    .me-type-card p {
        min-height: auto;
        margin-bottom: 14px;
    }

    .me-steps-section {
        margin-top: 42px;
    }

    .me-steps-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .me-simple-footer {
        padding: 14px 12px 22px !important;
        font-size: 11.5px !important;
    }
}

@media (max-width: 768px) {
    body {
        background: #f8fafc;
    }

    .app-main {
        padding: 0 10px 26px !important;
    }

    .app-topbar {
        margin: 10px auto 12px !important;
        padding: 16px !important;
        border-radius: 16px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .app-topbar .d-flex {
        width: 100% !important;
        flex-wrap: wrap !important;
    }

    .page-title {
        font-size: 21px !important;
    }

    .page-subtitle {
        font-size: 13px !important;
    }

    .app-content {
        padding-bottom: 24px !important;
    }

    form.coop-card.p-4,
    section.coop-card.p-4,
    .coop-card.p-4 {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    .form-control,
    .form-select {
        height: 42px !important;
        min-height: 42px !important;
        font-size: 14px !important;
    }

    textarea.form-control {
        height: auto !important;
    }

    .coop-btn-primary,
    .coop-btn-outline {
        width: 100% !important;
        min-height: 44px !important;
    }

    .d-flex.justify-content-between.flex-wrap.gap-2 {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .table-clean {
        min-width: 680px;
    }

    .table-clean th,
    .table-clean td {
        font-size: 13px;
    }

    .member-stepper-card {
        padding: 12px !important;
        border-radius: 18px !important;
    }

    .member-steps {
        justify-content: flex-start !important;
        align-items: stretch !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    .member-step-item {
        flex: 1 1 calc(50% - 10px) !important;
        max-width: calc(50% - 5px) !important;
        min-width: 0 !important;
        padding: 10px 11px !important;
        border-radius: 14px !important;
        background: #f8fafc !important;
    }

    .member-step-number {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        font-size: 12px !important;
    }

    .member-step-title {
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 13px !important;
        line-height: 1.2 !important;
    }

    .member-step-item.active {
        background: var(--coop-primary-soft) !important;
    }
}

@media (max-width: 420px) {
    .app-main {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .page-title {
        font-size: 20px !important;
    }

    form.coop-card.p-4,
    section.coop-card.p-4,
    .coop-card.p-4 {
        padding: 14px !important;
    }

    .form-control,
    .form-select {
        font-size: 13.5px !important;
    }

    .me-hero h1 {
        font-size: 22px;
    }

    .me-application-box {
        padding-left: 14px;
        padding-right: 14px;
    }

    .me-type-card {
        padding: 16px;
    }

    .me-help-btn {
        right: 14px;
        bottom: 14px;
    }
}

