/* ------------------------------------------------------------------ */
/* member.css - domain level member system (shared by every shop)      */
/* same design tokens / look as the shop stylesheet (mdstyle.css)      */
/* ASCII only - this file is converted to TIS-620 at build time        */
/* ------------------------------------------------------------------ */

:root {
    --primary-color: #c7000b;
    --primary-hover-color: #fa0a17;
    --dark-color: #333333;
    --light-gray-color: #f4f4f4;
    --white-color: #ffffff;
    --border-color: #dddddd;
    --secondary-color: #777777;
    --danger-color: #c0392b;
    --success-color: #14532d;
    --font-family: 'IBM Plex Sans Thai', sans-serif;
}

/* --- reset --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

/* --- TH / EN pairs (see member_t() in member_layout.php) --------------
   every bilingual string is printed twice, the language switcher only
   sets <html lang>. Default (no lang / lang="th") shows Thai.          */
html[lang="en"] .t-th { display: none; }
html:not([lang="en"]) .t-en { display: none; }

body {
    font-family: var(--font-family);
    color: var(--dark-color);
    line-height: 1.6;
    background-color: var(--light-gray-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary-color); }

.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- navigation bar --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--white-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    line-height: 1.2;
}

.navbar .nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    margin: 0;
}

.navbar .nav-menu > li { position: relative; }

.navbar .nav-menu li a {
    padding: 0 1rem;
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar .nav-menu li a:hover { color: var(--primary-color); }
.navbar .nav-menu li a.active { color: var(--primary-color); font-weight: 700; }

.nav-actions { display: flex; align-items: center; }
.nav-actions .btn { margin-left: 0.5rem; }
.nav-user {
    font-size: 0.95rem;
    color: var(--secondary-color);
    margin-left: 0.75rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- shops dropdown --- */
.shops-toggle {
    background-color: var(--light-gray-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.5;          /* same box as .btn so all navbar buttons share one height */
    font-weight: 500;
    color: var(--dark-color);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.shops-toggle i { line-height: 1; }
.shops-toggle i { font-size: 0.8rem; transition: transform 0.2s ease; }
.shops-toggle[aria-expanded="true"] i.fa-chevron-down { transform: rotate(180deg); }

.shops-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 110;
    min-width: 240px;
    max-width: 320px;
    overflow: hidden;
    text-align: left;
}
.shops-dropdown.show { display: block; }
.shops-dropdown a {
    display: block;
    padding: 0.7rem 1rem;
    text-decoration: none;
    color: var(--dark-color);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--light-gray-color);
}
.shops-dropdown a:last-child { border-bottom: none; }
.shops-dropdown a:hover { background-color: var(--light-gray-color); color: var(--primary-color); }
.shops-dropdown a small { display: block; color: var(--secondary-color); font-size: 0.8rem; }

/* --- language switcher (same markup/classes as the shop navbar) --- */
.language-switcher { position: relative; margin-left: 1rem; }
.lang-button {
    background-color: var(--light-gray-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.lang-button .fa-chevron-down { transition: transform 0.2s ease; font-size: 0.8rem; }
.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 110;
    width: 150px;
    overflow: hidden;
}
.lang-dropdown.show { display: block; }
.lang-option {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--dark-color);
    font-size: 0.95rem;
}
.lang-option:hover { background-color: var(--light-gray-color); }
/* dropdown links live inside <li class="nav-actions">: override the generic ".navbar .nav-menu li a" rule */
.navbar .nav-menu li a.lang-option { display: block; padding: 0.75rem 1rem; line-height: 1.5; font-size: 0.95rem; font-weight: 400; color: var(--dark-color); }
.navbar .nav-menu li a.lang-option:hover { background-color: var(--light-gray-color); color: var(--dark-color); }
.navbar .nav-menu li .shops-dropdown a { display: block; padding: 0.75rem 1rem; line-height: 1.5; font-weight: 500; color: var(--dark-color); }
.navbar .nav-menu li .shops-dropdown a:hover { background-color: var(--light-gray-color); color: var(--primary-color); }

/* --- hamburger --- */
.hamburger { display: none; cursor: pointer; background: none; border: none; padding: 4px; }
.hamburger .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    background-color: var(--dark-color);
}

/* --- buttons --- */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-family: var(--font-family);
    cursor: pointer;
    font-size: 1rem;
    display: inline-block;
    text-align: center;
    line-height: 1.5;
}
.btn-primary { background-color: var(--primary-color); color: var(--white-color); border-color: var(--primary-color); }
.btn-primary:hover { background-color: var(--primary-hover-color); border-color: var(--primary-hover-color); }
/* every control in the navbar shares one fixed height, whatever icon font is loaded */
.navbar .nav-actions .btn, .navbar .shops-toggle, .navbar .lang-button {
    /* shop .btn = 1rem text x body line-height 1.6 + 0.5rem padding top/bottom + 1px border = 2.6rem + 2px */
    height: calc(2.6rem + 2px);
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
    box-sizing: border-box;
    white-space: nowrap;
}
/* same weight/size as the shop: .btn is normal weight 1rem (in the shop the buttons sit outside <li>, so the
   ".navbar .nav-menu li a {font-weight:500}" rule never touches them); TH switcher is 500 / 0.9rem */
.navbar .nav-actions .btn, .navbar .nav-menu li a.btn { font-weight: 400; font-size: 1rem; }
.navbar .lang-button, .navbar .shops-toggle { font-weight: 500; font-size: 0.9rem; }
.navbar .shops-toggle i, .navbar .lang-button i { font-size: 0.8rem; line-height: 1; }
/* .navbar .nav-menu li a sets dark text - keep primary buttons inside the menu white */
.navbar .nav-menu li a.btn-primary, .navbar .nav-menu li a.btn-primary:hover { color: var(--white-color); }
.navbar .nav-menu li a.btn-secondary:hover { color: var(--dark-color); }
.btn-secondary { background-color: transparent; color: var(--dark-color); border-color: var(--border-color); }
.btn-secondary:hover { background-color: var(--light-gray-color); }
.btn-outline-primary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-weight: 600;
}
.btn-outline-primary:hover { background-color: var(--primary-color); color: var(--white-color); }
.btn-lg { padding: 0.8rem 1.8rem; font-size: 1.1rem; font-weight: 600; }
.btn-block { display: block; width: 100%; }

/* --- page shell --- */
main { flex: 1 0 auto; padding: 2rem 0 3rem; }

.page-head { text-align: center; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.8rem; line-height: 1.3; }
.page-head p { color: var(--secondary-color); font-size: 0.95rem; margin-top: 0.35rem; }

.member-card {
    background: var(--white-color);
    border: 1px solid var(--border-color);   /* กฎ: ห้ามใส่เส้นสีเน้น (accent bar) บนขอบ card &#8212; user ไม่เอา */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    padding: 1.75rem;
    margin: 0 auto;
    max-width: 720px;
}
.member-card.narrow { max-width: 460px; }
.member-card h2 { font-size: 1.3rem; margin-bottom: 1rem; }
.member-card .section-title {
    margin: 1.75rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-gray-color);
    font-size: 1.1rem;
}
.member-card .section-title:first-child { margin-top: 0; }

/* --- forms --- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 500; color: #555; }
.form-group .hint { display: block; font-size: 0.82rem; color: var(--secondary-color); margin-top: 0.25rem; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem;
    font-family: var(--font-family);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--white-color);
    color: var(--dark-color);
    font-size: 16px; /* avoid iOS auto zoom */
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}
.form-group input[readonly] { background-color: var(--light-gray-color); color: #666; }
.form-group input.is-invalid, .form-group select.is-invalid { border-color: var(--danger-color); }

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; min-width: 0; }

.form-actions { margin-top: 1.75rem; text-align: center; }
.form-actions .note { font-size: 0.82rem; color: var(--secondary-color); margin-bottom: 1rem; }
.form-links { margin-top: 1rem; text-align: center; font-size: 0.9rem; }

.honeypot-field { position: absolute; left: -9999px; top: -9999px; height: 0; overflow: hidden; }

/* --- segmented toggle (Thailand / International) --- */
.options-buttons { display: flex; gap: 1rem; margin-bottom: 1rem; }
.options-buttons .option-btn {
    flex: 1;
    padding: 0.9rem 0.5rem;
    font-size: 1rem;
    font-family: var(--font-family);
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--white-color);
    color: var(--dark-color);
    border-radius: 5px;
    transition: all 0.3s ease;
    display: block;
    text-align: center;
}
.options-buttons .option-btn input { position: absolute; opacity: 0; width: 0; height: 0; }
.options-buttons .option-btn.active {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}
.options-buttons .option-btn small { display: block; font-size: 0.8rem; opacity: 0.85; }

.addr-panel {
    margin-top: 0.5rem;
    padding: 1rem;
    background-color: var(--light-gray-color);
    border-radius: 5px;
}
.addr-status { font-size: 0.9rem; margin-top: 0.4rem; min-height: 1.4em; }
.addr-status.ok { color: var(--success-color); }
.addr-status.bad { color: var(--danger-color); }
.addr-manual-link { font-size: 0.85rem; margin-top: 0.4rem; display: inline-block; cursor: pointer; }

/* --- alerts / result screens --- */
.alert { padding: 1rem 1.25rem; border-radius: 5px; margin-bottom: 1.25rem; border: 1px solid transparent; }
.alert h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.alert-success { background: #dcfce7; color: var(--success-color); border-color: #86efac; }
.alert-error { background: #fcebeb; color: var(--danger-color); border-color: #e6a9a7; }
.alert-info { background: var(--light-gray-color); color: var(--dark-color); border-color: var(--border-color); }
.alert strong { font-weight: 700; }

.result-icon { font-size: 3rem; margin-bottom: 0.75rem; color: var(--primary-color); text-align: center; }
.result-icon.ok { color: #16a34a; }
.result-icon.bad { color: var(--danger-color); }
.result-text { text-align: center; }
.result-text p { margin-bottom: 0.6rem; }
.result-actions { margin-top: 1.75rem; text-align: center; }
.result-actions .btn { margin: 0.35rem 0.25rem; }

/* --- back to shop call to action --- */
.back-to-shop { margin-top: 1.5rem; text-align: center; }
.back-to-shop .btn { min-width: 260px; }
.back-to-shop .shop-name { display: block; font-size: 0.85rem; opacity: 0.9; font-weight: 400; }

/* --- account info rows --- */
.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--light-gray-color);
}
.info-list li:last-child { border-bottom: none; }
.info-list .label { color: #555; font-weight: 500; flex: 0 0 40%; }
.info-list .value { font-weight: 600; text-align: right; word-break: break-word; }

/* --- shop cards (index landing) --- */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.shop-card {
    background: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
}
.shop-card:hover { box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.shop-card .thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--light-gray-color);
    max-width: 100%;
    display: block;
}
.shop-card .thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--light-gray-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border-color);
    font-size: 2.5rem;
}
.shop-card .body { padding: 1rem; display: flex; flex-direction: column; flex: 1; }
.shop-card h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.shop-card p { font-size: 0.9rem; color: var(--secondary-color); flex: 1; margin-bottom: 1rem; }

/* --- footer --- */
.member-footer {
    flex-shrink: 0;
    background: var(--white-color);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    font-size: 0.85rem;
    color: var(--secondary-color);
    text-align: center;
}
.member-footer a { color: var(--secondary-color); }

/* --- responsive --- */
@media (max-width: 768px) {
    .navbar { padding: 0.9rem 16px; }
    .hamburger { display: block; }
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 64px;
        flex-direction: column;
        align-items: stretch;
        background-color: var(--white-color);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0,0,0,0.08);
        padding: 0 16px 1.5rem;
        border-bottom: 1px solid var(--border-color);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }
    .nav-menu.active { left: 0; }
    .nav-menu > li { padding: 0.75rem 0; width: 100%; }
    .navbar .nav-menu li a { display: block; padding: 0.5rem 0; }
    .shops-toggle { width: 100%; justify-content: center; }
    .shops-dropdown {
        position: static;
        width: 100%;
        max-width: none;
        box-shadow: none;
        margin-top: 6px;
        text-align: center;
    }
    .nav-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        width: 100%;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
    }
    .nav-actions .btn { margin-left: 0; width: 100%; }
    .nav-user { margin-left: 0; max-width: none; text-align: center; }
    .nav-actions .language-switcher { width: 100%; margin-left: 0; }
    .lang-button { width: 100%; justify-content: center; }
    .lang-dropdown {
        position: static;
        width: 100%;
        box-shadow: none;
        margin-top: 6px;
        text-align: center;
    }

    main { padding: 1.5rem 0 2rem; }
    .member-card { padding: 1.25rem 16px; }
    .page-head h1 { font-size: 1.45rem; }
    .form-row { display: block; }
    .options-buttons { flex-direction: column; gap: 0.6rem; }
    .info-list li { flex-direction: column; gap: 0.15rem; }
    .info-list .label { flex: none; }
    .info-list .value { text-align: left; }
    .back-to-shop .btn { min-width: 0; width: 100%; }
}

@media (max-width: 480px) {
    .shop-grid { grid-template-columns: 1fr; }
    .member-card h2 { font-size: 1.15rem; }
}
