
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0f4c81;
    --primary-light: #e6f0fa;
    --primary-hover: #0a355d;
    --accent: #d97706;
    --bg-main: #f4f7fc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --shadow-sm: 0 1px 3px rgba(15, 76, 129, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(15, 76, 129, 0.08);
    --shadow-lg: 0 10px 25px -3px rgba(15, 76, 129, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-main);
    color: var(--text-main);
    font: 14.5px/1.6 Prompt, Tahoma, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

header {
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.nav,
.wrap {
    width: min(1180px, calc(100% - 32px));
    margin: auto;
}

.nav {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-main);
    font-weight: 600;
}

.brand img {
    height: 42px;
    width: auto;
    object-fit: contain;
}

.brand b {
    background: linear-gradient(135deg, #0f4c81, #1e3a8a);
    color: white;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 22px;
    box-shadow: var(--shadow-sm);
}

.brand span {
    display: flex;
    flex-direction: column;
}

.brand small {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
}

nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

nav a,
nav span {
    color: #334155;
    font-weight: 500;
    font-size: 14px;
}

nav a:hover {
    color: var(--primary);
}

.navbtn {
    background: var(--primary-light);
    padding: 10px 18px;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 600;
    transition: all 0.2s ease;
}

.navbtn:hover {
    background: var(--primary);
    color: white;
}

.menu {
    display: none;
}

.wrap {
    padding: 32px 0 64px;
    min-height: calc(100vh - 150px);
}

.hero {
    border-radius: 16px;
    padding: 48px 56px;
    background: linear-gradient(135deg, #0a365f 0%, #145c9b 50%, #1d4ed8 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 270px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.hero small,
.heading small {
    letter-spacing: 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #93c5fd;
}

.hero h1 {
    font-size: 36px;
    line-height: 1.3;
    margin: 12px 0;
    font-weight: 700;
}

.hero em {
    color: #ffd60a;
    font-style: normal;
}

.hero p {
    color: #e2e8f0;
    margin-bottom: 24px;
    font-size: 15px;
}

.heroicon {
    font-size: 75px;
    opacity: 0.95;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    padding: 11px 20px;
    font: 600 14px Prompt;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 76, 129, 0.2);
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn.white {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn.white:hover {
    background: #f8fafc;
}

.heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 36px 0 16px;
}

.heading h2 {
    margin: 4px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

.heading span,
.meta {
    color: var(--text-muted);
    font-size: 12px;
}

.columns {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 28px;
}

.card {
    background: rgb(251, 250, 250);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.columns aside {
    padding: 20px;
    height: max-content;
}

.columns aside h3 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.columns aside h3 i {
    margin-right: 10px;
    color: var(--primary);
}

.cat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: #475569;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.cat i {
    margin-right: 10px;
    width: 18px;
    text-align: center;
    color: var(--primary);
}

.cat span {
    display: flex;
    align-items: center;
}

.cat span.pill,
.cat span:last-child {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.cat:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(2px);
}

.cat:hover span.pill {
    background: var(--primary);
    color: white;
}

.hint {
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.8;
}

.search {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font: 14px Prompt;
    color: var(--text-main);
    background: #fff;
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.1);
}

.topic {
    display: flex;
    gap: 16px;
    padding: 18px;
    margin-bottom: 12px;
    align-items: flex-start;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.topic:hover {
    background: white;
    border-color: var(--border-color);
    box-shadow: var(--shadow-md);
}

.bubble {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 10px;
    font-size: 18px;
    flex-shrink: 0;
}

.grow {
    flex: 1;
    min-width: 0;
}

.topic h3 {
    margin: 4px 0 6px;
    font-size: 16px;
    font-weight: 600;
}

.topic h3 a {
    color: var(--text-main);
}

.topic h3 a:hover {
    color: var(--primary);
}

.topic p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.7;
    margin: 0 0 8px;
}

.count {
    border-left: 1px solid var(--border-color);
    padding: 6px 14px;
    text-align: center;
    color: var(--primary);
    min-width: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.count b,
.count small {
    display: block;
}

.count b {
    font-size: 16px;
    font-weight: 700;
}

.count small {
    font-size: 10px;
    color: var(--text-muted);
}

.empty {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.form {
    max-width: 780px;
    margin: 16px auto;
    padding: 32px;
}

.form.narrow {
    max-width: 440px;
    margin: 60px auto;
}

.form h2 {
    margin: 0 0 20px;
    color: var(--text-main);
    font-size: 22px;
}

.form label {
    display: block;
    margin: 16px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.form textarea {
    resize: vertical;
}

.form button {
    margin-top: 20px;
    width: 100%;
    padding: 12px;
}

.form p {
    font-size: 13px;
    color: var(--text-muted);
}

.notice {
    background: var(--primary-light);
    color: var(--primary);
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 500;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.error {
    color: #ef4444;
}

.detail {
    padding: 32px;
}

.detail h1 {
    font-size: 26px;
    margin: 12px 0;
    color: var(--text-main);
}

.body {
    line-height: 2.1;
    white-space: normal;
    overflow-wrap: anywhere;
    padding: 20px 0;
    color: #334155;
}

.reply {
    padding: 20px;
    margin: 16px 0;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

.reply p {
    line-height: 1.8;
}

.inline {
    display: flex;
    gap: 10px;
}

.pill {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.scroll {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

td,
th {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

th {
    color: #334155;
    font-weight: 600;
    background: #f8fafc;
}

.mini {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.red {
    background: #ef4444 !important;
}

footer {
    background: white;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    padding: 28px;
    font-size: 12px;
}

/* RESPONSIVE MOBILE */

@media(max-width: 760px) {
    .nav {
        height: 68px;
    }

    .menu {
        display: block;
        background: none;
        border: 0;
        font-size: 24px;
        color: var(--primary);
        cursor: pointer;
    }

    nav {
        display: none;
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        background: white;
        padding: 24px;
        flex-direction: column;
        align-items: flex-start;
        z-index: 100;
        box-shadow: var(--shadow-lg);
        border-bottom: 1px solid var(--border-color);
        border-radius: 0 0 16px 16px;
    }

    nav.show {
        display: flex;
    }

    .hero {
        padding: 32px 24px;
        min-height: auto;
    }

    .hero h1 {
        font-size: 26px;
    }

    .heroicon {
        display: none;
    }

    .columns {
        grid-template-columns: 1fr;
    }

    .columns aside {
        padding: 16px;
    }

    .hint {
        display: none;
    }

    .cat {
        display: inline-flex;
        margin: 4px;
    }

    .topic {
        padding: 16px;
        gap: 12px;
    }

    .bubble {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .topic h3 {
        font-size: 14.5px;
    }

    .form {
        padding: 20px;
    }

    .detail {
        padding: 20px;
    }

    .detail h1 {
        font-size: 22px;
    }
}

/* =================================
   HERO BANNER - KHON KAEN MUNICIPALITY
================================= */

.hero-new {
    position: relative;
    width: 100%;
    min-height: 320px;

    background-image: url('assets/municipal-banner.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;

    display: flex;
    align-items: center;

    padding: 40px 4.5%;
    margin: 0 0 35px;

    border: none;
    outline: none;
    border-radius: 0;
    box-shadow: none;

    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 53%;
    color: white;
}

.hero-content small {
    color: #93c5fd;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
}

.hero-content h1 {
    font-size: 36px;
    line-height: 1.35;
    margin: 12px 0;
    font-weight: 700;
    color: white;
}

.hero-content h1 em {
    color: #ffd60a;
    font-style: normal;
}

.hero-content p {
    color: white;
    font-size: 14px;
    margin-bottom: 22px;
}

.hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    background: white;
    color: #10467e;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: all .25s ease;
}

.hero-btn:hover {
    background: #ffca28;
    color: #103b70;
    transform: translateY(-3px);
}

/* TABLET */

@media (max-width: 768px) {

    .hero-new {
        min-height: 220px;
        padding: 25px 5%;
    }

    .hero-content {
        width: 55%;
    }

    .hero-content h1 {
        font-size: 23px;
    }

    .hero-content p {
        font-size: 10px;
    }

    .hero-btn {
        font-size: 11px;
        padding: 8px 12px;
    }
}

/* MOBILE */

@media (max-width: 480px) {

    .hero-new {
        min-height: 170px;
    }

    .hero-content {
        width: 58%;
    }

    .hero-content h1 {
        font-size: 17px;
    }

    .hero-content small {
        font-size: 8px;
    }

    .hero-content p {
        font-size: 8px;
        margin-bottom: 10px;
    }

    .hero-btn {
        font-size: 9px;
        padding: 6px 9px;
    }
}

/* ===== HERO BANNER KHON KAEN ===== */

.hero-new {
    width: 100%;
    min-height: 320px;
    padding: 40px 4.5%;

    background-image: url('municipal-banner.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    display: flex;
    align-items: center;

    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    margin-bottom: 35px;
}

.hero-content {
    width: 53%;
    color: #fff;
}

.hero-content small {
    color: #bfdbfe;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
}

.hero-content h1 {
    font-size: 36px;
    line-height: 1.4;
    margin: 12px 0;
    color: #fff;
}

.hero-content h1 em {
    color: #ffd60a;
    font-style: normal;
}

.hero-content p {
    color: #fff;
    font-size: 14px;
    margin-bottom: 22px;
}

.hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #10467e;
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
}

.hero-btn:hover {
    background: #ffd60a;
    color: #103b70;
}

/* RESPONSIVE HERO BANNER */

@media (max-width: 768px) {

    .hero-new {
        min-height: 220px;
        padding: 25px 5%;
    }

    .hero-content {
        width: 58%;
    }

    .hero-content h1 {
        font-size: 23px;
    }

    .hero-content p {
        font-size: 10px;
    }

    .hero-btn {
        font-size: 11px;
        padding: 8px 12px;
    }
}

/* BACKGROUND WEBSITE */

html, body {
    min-height: 100%;
}

body {
    background-color: #eaf5ff;
    background-image: url('background.png');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* MY TOPICS PAGE */

.my-topic-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin: 20px 0;
}

.my-topic-stat {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.my-topic-stat i {
    display: block;
    font-size: 23px;
    color: var(--primary);
    margin-bottom: 8px;
}

.my-topic-stat strong {
    display: block;
    font-size: 26px;
    color: var(--text-main);
}

.my-topic-stat span {
    color: var(--text-muted);
    font-size: 12px;
}

.my-topic-stat.approved i {
    color: #16a34a;
}

.my-topic-stat.pending i {
    color: #d97706;
}

.my-topic-stat.rejected i {
    color: #dc2626;
}

.my-topic-stat.hidden i {
    color: #64748b;
}

.my-topic-card {
    padding: 24px;
    margin-top: 20px;
}

.my-topic-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

.my-topic-table {
    min-width: 700px;
}

.topic-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.topic-status.approved {
    color: #15803d;
    background: #dcfce7;
}

.topic-status.pending {
    color: #b45309;
    background: #fef3c7;
}

.topic-status.rejected {
    color: #b91c1c;
    background: #fee2e2;
}

.topic-status.hidden,
.topic-status.unknown {
    color: #475569;
    background: #e2e8f0;
}

@media(max-width: 760px) {

    .my-topic-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .my-topic-stat:last-child {
        grid-column: auto;
    }

    .my-topic-card {
        padding: 15px;
    }

    .heading h2 {
        font-size: 21px;
    }
}

/* =========================================
   MY TOPICS - MUNICIPAL WEBBOARD
   ปรับสมดุลหน้ากระทู้ของฉัน
========================================= */

/* ส่วนหัวและปุ่ม */

.my-topics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 0 0 26px;
}

.my-topics-header .heading {
    margin: 0;
    flex: 1;
}

.my-topics-header .heading h2 {
    font-size: 26px;
    margin: 5px 0;
    color: #173957;
}

.my-topics-header .heading p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
}

.my-topics-create {
    flex-shrink: 0;
    min-height: 46px;
    padding: 12px 22px;
    border-radius: 10px;
    gap: 8px;
}

/* การ์ดสรุปสถานะ */

.my-topic-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
    margin: 0 0 26px;
}

.my-topic-stat {
    min-width: 0;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 14px;
    background: #fff;
    border: 1px solid #dce6f0;
    border-radius: 14px;
    box-shadow: 0 3px 12px rgba(15,43,75,.06);
    transition: transform .2s ease, box-shadow .2s ease;
}

.my-topic-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(15,43,75,.10);
}

.my-topic-stat i {
    font-size: 27px;
    margin-bottom: 10px;
    color: #154f83;
}

.my-topic-stat strong {
    font-size: 29px;
    line-height: 1.3;
    font-weight: 700;
    color: #173957;
}

.my-topic-stat span {
    margin-top: 8px;
    font-size: 13px;
    color: #64748b;
}

/* สีแยกตามสถานะ */

.my-topic-stat.approved i {
    color: #16a34a;
}

.my-topic-stat.pending i {
    color: #e58a00;
}

.my-topic-stat.rejected i {
    color: #dc2626;
}

/* กล่องรายการกระทู้ */

.my-topic-card {
    width: 100%;
    margin-top: 0;
    padding: 26px;
    background: #fff;
    border: 1px solid #dce6f0;
    border-radius: 15px;
    box-shadow: 0 3px 12px rgba(15,43,75,.05);
}

.my-topic-card h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 22px;
    font-size: 19px;
    color: #173957;
}

/* ตารางกระทู้ */

.my-topic-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.my-topic-table th {
    padding: 15px 14px;
    background: #f5f8fc;
    color: #234e73;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid #dce6f0;
}

.my-topic-table td {
    padding: 16px 14px;
    font-size: 13px;
    vertical-align: middle;
    border-bottom: 1px solid #e5ebf2;
}

.my-topic-table tbody tr:hover td {
    background: #f7faff;
}

.my-topic-table tbody tr:last-child td {
    border-bottom: none;
}

.my-topic-table td strong {
    color: #173957;
    font-weight: 600;
}

/* ป้ายสถานะ */

.topic-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
}

.topic-status.approved {
    color: #15803d;
    background: #dcfce7;
}

.topic-status.pending {
    color: #b45309;
    background: #fef3c7;
}

.topic-status.rejected {
    color: #b91c1c;
    background: #fee2e2;
}

/* ปุ่มดูรายละเอียด */

.my-topic-table .btn.mini {
    min-height: 36px;
    padding: 8px 13px;
    white-space: nowrap;
    border-radius: 8px;
}

/* หน้าจอแท็บเล็ต */

@media (max-width: 900px) {

    .my-topic-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .my-topic-stat {
        min-height: 135px;
    }

    .my-topic-card {
        padding: 20px;
    }
}

/* หน้าจอมือถือ */

@media (max-width: 600px) {

    .my-topics-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 20px;
    }

    .my-topics-header .heading h2 {
        font-size: 22px;
    }

    .my-topics-create {
        width: 100%;
    }

    .my-topic-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px;
        margin-bottom: 18px;
    }

    .my-topic-stat {
        min-height: 120px;
        padding: 15px 8px;
    }

    .my-topic-stat i {
        font-size: 23px;
    }

    .my-topic-stat strong {
        font-size: 25px;
    }

    .my-topic-stat span {
        font-size: 11px;
    }

    .my-topic-card {
        padding: 15px;
        border-radius: 12px;
    }

    .my-topic-card h3 {
        font-size: 16px;
        margin-bottom: 16px;
    }
}

/* สีสถานะหน้า Admin ให้เหมือนหน้าผู้ใช้งาน */

/* รออนุมัติ */

.status-pending,
.topic-status.pending,
.status.pending {
    background: #fef3c7 !important;
    color: #b45309 !important;
    border: 0 !important;
}

/* อนุมัติแล้ว / เผยแพร่แล้ว */

.status-approved,
.status-published,
.topic-status.approved,
.status.published {
    background: #dcfce7 !important;
    color: #15803d !important;
    border: 0 !important;
}

/* ไม่อนุมัติ */

.status-rejected,
.topic-status.rejected,
.status.rejected {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border: 0 !important;
}

/* =========================================
   MUNICIPAL WEBBOARD
   ADMIN STATUS COLORS
   ใช้สีเดียวกับหน้าผู้ใช้งาน
========================================= */

/* รูปแบบป้ายสถานะ */

.topic-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 13px;
    border: none;
    border-radius: 30px;
    font-family: Prompt, Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

/* รออนุมัติ */

.topic-status.pending {
    background-color: #fef3c7 !important;
    color: #b45309 !important;
}

/* อนุมัติแล้ว / เผยแพร่แล้ว */

.topic-status.approved {
    background-color: #dcfce7 !important;
    color: #15803d !important;
}

/* ไม่อนุมัติ */

.topic-status.rejected {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
}

/* ถูกซ่อน - สำหรับ Admin */

.topic-status.hidden {
    background-color: #e2e8f0 !important;
    color: #475569 !important;
}

/* จัดตำแหน่งป้ายสถานะในตาราง */

table td .topic-status {
    vertical-align: middle;
}

/* รองรับหน้าจอมือถือ */

@media (max-width: 600px) {

    .topic-status {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* =========================================
   ADMIN TOPIC MANAGEMENT
   ปรับสมดุลหน้าจัดการกระทู้
========================================= */

/* ขยายการ์ดจัดการกระทู้ให้เต็มพื้นที่ */

.admin-topic-card {
    width: 100%;
    max-width: none;
    margin: 24px auto;
    padding: 26px 28px;
    box-sizing: border-box;
}

/* ส่วนหัว */

.admin-topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.admin-topic-header h3 {
    margin: 0;
    color: #173957;
    font-size: 20px;
}

.admin-topic-header h3 i {
    color: #155184;
    margin-right: 7px;
}

.admin-topic-header p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 12px;
}

.admin-topic-total {
    background: #eaf2fb;
    color: #155184;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

/* ตาราง */

.admin-topic-scroll {
    width: 100%;
    overflow-x: auto;
    border-radius: 9px;
}

.admin-topic-table {
    width: 100%;
    min-width: 850px;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 13px;
}

/* กำหนดสัดส่วนคอลัมน์ */

.admin-topic-table th:nth-child(1),
.admin-topic-table td:nth-child(1) {
    width: 39%;
}

.admin-topic-table th:nth-child(2),
.admin-topic-table td:nth-child(2) {
    width: 17%;
}

.admin-topic-table th:nth-child(3),
.admin-topic-table td:nth-child(3) {
    width: 18%;
}

.admin-topic-table th:nth-child(4),
.admin-topic-table td:nth-child(4) {
    width: 26%;
}

/* หัวตาราง */

.admin-topic-table th {
    background: #f1f6fb;
    color: #334155;
    padding: 15px 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* เนื้อหาตาราง */

.admin-topic-table td {
    padding: 17px 12px;
    border-bottom: 1px solid #dce5ef;
    vertical-align: middle;
    white-space: normal;
}

.admin-topic-table tbody tr:hover {
    background: #f5f9fd;
}

/* หัวข้อกระทู้ */

.admin-topic-title {
    overflow-wrap: anywhere;
    line-height: 1.7;
}

.admin-topic-title a {
    color: #155184;
    font-weight: 500;
}

.admin-topic-title a:hover {
    color: #0b3154;
    text-decoration: underline;
}

/* ปุ่มจัดการ */

.admin-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.admin-topic-card .admin-actions .btn {
    width: auto;
    margin: 0;
    padding: 9px 12px;
    min-height: 38px;
    font-size: 12px;
    white-space: nowrap;
}

/* สถานะ */

.admin-topic-table .topic-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.admin-topic-table .topic-status.pending {
    color: #b45309;
    background: #fef3c7;
}

.admin-topic-table .topic-status.approved {
    color: #15803d;
    background: #dcfce7;
}

.admin-topic-table .topic-status.rejected {
    color: #b91c1c;
    background: #fee2e2;
}

.admin-topic-table .topic-status.hidden {
    color: #475569;
    background: #e2e8f0;
}

/* ไม่มีข้อมูล */

.admin-empty {
    text-align: center;
    padding: 35px !important;
    color: #94a3b8;
}

.admin-empty i {
    margin-right: 7px;
}

/* =========================================
   PAGINATION
========================================= */

.admin-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 23px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
}

.pagination-info {
    color: #64748b;
    font-size: 12px;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 36px;
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid #dce5ef;
    border-radius: 7px;
    background: #fff;
    color: #155184;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all .2s ease;
}

.page-link:hover {
    background: #eaf2fb;
    border-color: #155184;
}

.page-link.active {
    background: #155184;
    border-color: #155184;
    color: #fff;
}

.page-link.disabled {
    color: #b8c2cf;
    background: #f8fafc;
    pointer-events: none;
}

.page-dots {
    color: #64748b;
    padding: 0 3px;
}

/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 900px) {

    .admin-topic-card {
        padding: 20px;
    }

    .admin-topic-header h3 {
        font-size: 18px;
    }
}

@media (max-width: 600px) {

    .admin-topic-card {
        padding: 15px;
    }

    .admin-topic-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-pagination {
        flex-direction: column;
        align-items: flex-start;
    }

    .pagination-buttons {
        width: 100%;
    }

    .page-link {
        min-width: 34px;
    }
}

/* =========================================
   HOMEPAGE - COMPACT TOPIC CARDS
   ลดความกว้างการ์ดกระทู้ 15%
========================================= */

.home-topic-content article.topic.card {
    width: 85%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 12px;
    box-sizing: border-box;
    padding: 16px 20px;
    border-radius: 13px;
}

/* จัดเนื้อหาภายใน */

.home-topic-content .topic .grow {
    min-width: 0;
}

.home-topic-content .topic h3 {
    font-size: 15px;
    margin: 5px 0;
}

.home-topic-content .topic p {
    font-size: 12px;
    line-height: 1.7;
}

/* ปรับขนาดไอคอน */

.home-topic-content .bubble {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* ระบบแบ่งหน้า */

.home-pagination {
    width: 85%;
    margin: 20px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* มือถือไม่ย่อมากเกินไป */

@media (max-width: 760px) {

    .home-topic-content article.topic.card {
        width: 100%;
        padding: 14px;
    }

    .home-pagination {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================
   MOBILE STATISTICS FIX
   การ์ดสถิติ 4 ใบ แสดง 2 คอลัมน์ x 2 แถว
========================================= */

@media screen and (max-width: 760px) {

    .my-topic-stats {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 11px !important;
        align-items: stretch;
    }

    .my-topic-stats > .my-topic-stat,
    .my-topic-stats > .my-topic-stat:last-child {
        grid-column: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        min-height: 120px;
    }
}

/* ==========================================
   ADMIN MOBILE RESPONSIVE
   ปรับหน้าจอ Admin ให้สมดุลกับหน้าผู้ใช้งาน
========================================== */

@media screen and (max-width: 760px) {

    /* พื้นที่หลัก */
    .wrap {
        width: calc(100% - 24px) !important;
        padding: 20px 0 40px !important;
    }

    /* หัวข้อหน้า */
    .wrap > h1 {
        font-size: 23px !important;
        margin: 12px 0 18px !important;
        line-height: 1.5;
    }

    /* กล่องแจ้งเตือนและกล่องข้อมูล */
    .card.form {
        width: 100% !important;
        max-width: 100% !important;
        margin: 14px auto !important;
        padding: 18px !important;
        border-radius: 14px !important;
    }

    /* กล่องกระทู้รอตรวจสอบ */
    .card.form:not(.admin-topic-card) h3 {
        font-size: 17px;
        margin-bottom: 10px;
    }

    .card.form:not(.admin-topic-card) h2 {
        font-size: 25px;
        margin: 8px 0;
    }

    .card.form:not(.admin-topic-card) p {
        font-size: 12px;
        line-height: 1.7;
    }

    /* กล่องจัดการกระทู้ */
    .admin-topic-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        margin: 16px auto !important;
        border-radius: 14px !important;
    }

    /* หัวข้อจัดการกระทู้ */
    .admin-topic-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        margin-bottom: 16px !important;
    }

    .admin-topic-header h3 {
        font-size: 17px !important;
    }

    .admin-topic-header p {
        font-size: 12px !important;
    }

    .admin-topic-total {
        font-size: 12px !important;
        padding: 7px 12px !important;
    }

    /* ตารางกระทู้ เลื่อนซ้ายขวาได้ */
    .admin-topic-scroll {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    .admin-topic-table {
        min-width: 850px !important;
        width: 100% !important;
    }

    .admin-topic-table th,
    .admin-topic-table td {
        padding: 12px 10px !important;
        font-size: 12px !important;
    }

    /* ปุ่มอนุมัติ ไม่อนุมัติ และลบ */
    .admin-topic-table .admin-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 7px !important;
    }

    .admin-topic-table .admin-actions .btn {
        width: auto !important;
        min-height: 36px;
        padding: 8px 11px !important;
        font-size: 11px !important;
        margin: 0 !important;
    }

    /* ระบบแบ่งหน้า */
    .admin-pagination {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 14px !important;
        padding-top: 16px !important;
    }

    .pagination-info {
        text-align: center;
        font-size: 12px !important;
    }

    .pagination-buttons {
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 5px !important;
        width: 100%;
    }

    .page-link {
        min-width: 34px;
        min-height: 36px;
        padding: 7px 9px !important;
        font-size: 11px !important;
    }

    /* เพิ่มหมวดหมู่ */
    .card.form .inline {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .card.form .inline input {
        width: 100% !important;
        min-width: 0;
    }

    .card.form .inline button {
        width: 100% !important;
        margin: 0 !important;
    }

    /* รายชื่อสมาชิก */
    .card.form .scroll {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .card.form .scroll table {
        min-width: 620px;
    }

    /* ป้ายหมวดหมู่ */
    .card.form .pill {
        display: inline-block;
        margin: 3px;
        font-size: 11px;
    }

    /* เมนูโทรศัพท์ */
    nav.show {
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        padding: 14px 20px !important;
        gap: 12px !important;
    }

    nav.show a,
    nav.show span {
        font-size: 14px;
    }

    nav.show .navbtn {
        padding: 9px 14px;
    }

}

/* โทรศัพท์จอเล็ก */
@media screen and (max-width: 380px) {

    .wrap {
        width: calc(100% - 20px) !important;
    }

    .admin-topic-card {
        padding: 12px !important;
    }

    .card.form {
        padding: 14px !important;
    }

    .admin-topic-header h3 {
        font-size: 15px !important;
    }

    .pagination-buttons {
        gap: 4px !important;
    }

}
    
/* =========================================
   USER PAGE - MY TOPIC CARD WIDTH 50%
   ปรับเฉพาะกล่องรายการกระทู้ฝั่งผู้ใช้งาน
   ไม่กระทบหน้า Admin
========================================= */

.my-topic-card {
    width: 50% !important;
    max-width: 50% !important;
    margin: 20px auto !important;
    box-sizing: border-box !important;
}

/* ตารางภายในกล่อง */
.my-topic-card .my-topic-table {
    width: 100%;
}

/* หน้าจอแท็บเล็ต */
@media (max-width: 900px) {
    .my-topic-card {
        width: 75% !important;
        max-width: 75% !important;
    }
}

/* หน้าจอโทรศัพท์ */
@media (max-width: 600px) {
    .my-topic-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 15px !important;
    }
}
    /* =========================================
   ปรับปุ่มอนุมัติ / ไม่อนุมัติ
   เฉพาะหน้าจัดการกระทู้แอดมิน
========================================= */

/* สีปุ่มปกติ: เทา */
.admin-actions button[name="action"][value="approve"],
.admin-actions button[name="action"][value="reject"] {
    background: #D1D5DB !important;
    color: #374151 !important;
    border: 1px solid #C4C9D1 !important;
    box-shadow: none !important;
    transition: background 0.2s ease,
                color 0.2s ease,
                transform 0.2s ease !important;
}

/* Hover ปุ่มอนุมัติ: สีเขียว */
.admin-actions button[name="action"][value="approve"]:hover {
    background: #16A34A !important;
    color: #FFFFFF !important;
    border-color: #16A34A !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(22, 163, 74, 0.2) !important;
}

/* Hover ปุ่มไม่อนุมัติ: สีแดง */
.admin-actions button[name="action"][value="reject"]:hover {
    background: #DC2626 !important;
    color: #FFFFFF !important;
    border-color: #DC2626 !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 38, 38, 0.2) !important;
}

/* ขณะกดปุ่ม */
.admin-actions button[name="action"][value="approve"]:active,
.admin-actions button[name="action"][value="reject"]:active {
    transform: translateY(0);
}


/* =========================================
   USER - MY TOPICS
   ให้หัวข้อกระทู้ยาวขึ้นบรรทัดใหม่อัตโนมัติ
   จำกัดผลเฉพาะตารางรายการกระทู้ของผู้ใช้ทั่วไป
========================================= */

.my-topic-card .my-topic-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
}

/* ยกเลิก nowrap เฉพาะเนื้อหาในตารางกระทู้ของฉัน */
.my-topic-card .my-topic-table th,
.my-topic-card .my-topic-table td {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

/* ให้ชื่อหัวข้อกระทู้ตัดบรรทัดได้ แม้ไม่มีเว้นวรรค */
.my-topic-card .my-topic-table td:first-child,
.my-topic-card .my-topic-table td:first-child strong,
.my-topic-card .my-topic-table td:first-child a {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.8;
}

/* คงป้ายสถานะและปุ่มให้แสดงเป็นบรรทัดเดียว */
.my-topic-card .my-topic-table .topic-status,
.my-topic-card .my-topic-table .btn {
    white-space: nowrap !important;
}

/* =========================================
   USER - ALL TOPICS LIST WIDTH BALANCE
   ขยายการ์ดรายการกระทู้ให้สมดุลกับการ์ดสถิติด้านบน
   จำกัดผลเฉพาะหน้ารายการกระทู้ของผู้ใช้ทั่วไป
========================================= */

.my-topic-stats {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.my-topic-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

.my-topic-card .my-topic-table {
    width: 100% !important;
    max-width: 100% !important;
}

/* แท็บเล็ตและมือถือ: ให้กล่องใช้ความกว้างพื้นที่เนื้อหาทั้งหมด */
@media (max-width: 900px) {
    .my-topic-card {
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 600px) {
    .my-topic-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
}


/* =========================================
   USER - MOBILE TOPIC TABLE READABILITY
   ปรับเฉพาะหน้าจอโทรศัพท์:
   ให้หัวข้อกระทู้มีพื้นที่พออ่าน ไม่ตัดคำถี่เกินไป
   ใช้การเลื่อนตารางแนวนอนแทนการบีบคอลัมน์
   ไม่กระทบหน้าจอ Desktop และ Admin
========================================= */
@media screen and (max-width: 760px) {

    /* เปิดพื้นที่เลื่อนแนวนอนให้ตารางบนมือถือ */
    .my-topic-card .scroll {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    /* ป้องกันตารางถูกบีบจนคอลัมน์หัวข้อแคบเกินไป */
    .my-topic-card .my-topic-table {
        width: 760px !important;
        min-width: 760px !important;
        max-width: none !important;
        table-layout: fixed !important;
    }

    /* กำหนดสัดส่วนคอลัมน์ให้หัวข้อมีพื้นที่อ่านได้ */
    .my-topic-card .my-topic-table th:nth-child(1),
    .my-topic-card .my-topic-table td:nth-child(1) {
        width: 28% !important;
    }

    .my-topic-card .my-topic-table th:nth-child(2),
    .my-topic-card .my-topic-table td:nth-child(2) {
        width: 18% !important;
    }

    .my-topic-card .my-topic-table th:nth-child(3),
    .my-topic-card .my-topic-table td:nth-child(3) {
        width: 17% !important;
    }

    .my-topic-card .my-topic-table th:nth-child(4),
    .my-topic-card .my-topic-table td:nth-child(4) {
        width: 17% !important;
    }

    .my-topic-card .my-topic-table th:nth-child(5),
    .my-topic-card .my-topic-table td:nth-child(5) {
        width: 20% !important;
    }

    /* ให้หัวข้อขึ้นบรรทัดตามพื้นที่คอลัมน์ ไม่บีบเป็นคำสั้น ๆ */
    .my-topic-card .my-topic-table td:first-child,
    .my-topic-card .my-topic-table td:first-child strong,
    .my-topic-card .my-topic-table td:first-child a {
        white-space: normal !important;
        overflow-wrap: break-word !important;
        word-break: normal !important;
        line-height: 1.8 !important;
    }

    /* คงวันที่ สถานะ และปุ่มให้อ่าน/กดได้ */
    .my-topic-card .my-topic-table td:nth-child(3),
    .my-topic-card .my-topic-table td:nth-child(4),
    .my-topic-card .my-topic-table td:nth-child(5),
    .my-topic-card .my-topic-table .topic-status,
    .my-topic-card .my-topic-table .btn {
        white-space: nowrap !important;
    }
}
