:root {
    --primary-red: #7a050b;
    --secondary-navy: #05367a;
    --light-gray: #dedede;
    --medium-gray: #94a3b8;
    --dark-gray: #1e293b;
    --white: #ffffff;
    --bg-gray: #f5f5f5;
    --border-gray: #dedede;
}

body {
    background-color: var(--bg-gray);
    color: var(--dark-gray);
    font-family: 'Sarabun', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, #ffffff 0%, var(--bg-gray) 100%) !important;
    border-bottom: 2px solid var(--border-gray) !important;
}

.main-title {
    color: var(--primary-red);
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 1.8rem;
    line-height: 24px;
}

.header-logo {
    width: 80px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-info {
    font-size: 0.95rem;
    color: var(--secondary-navy);
}

.text-right { text-align: right; }
.text-left { text-align: left; }
.justify-content-center { justify-content: center !important; }
.justify-content-right { justify-content: right !important; }
.justify-content-left { justify-content: left !important; }

#search-input {
    border: 2px solid var(--border-gray);
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

#search-input:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 0.25rem rgba(139, 21, 56, 0.15);
}

.desktop-view { display: block; }
.mobile-view { display: none; }

.table-responsive {
    background-color: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border-gray);
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar { height: 8px; }
.table-responsive::-webkit-scrollbar-track { background: var(--bg-gray); border-radius: 4px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--light-gray); border-radius: 4px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: var(--medium-gray); }

#announcement-table {
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
    min-width: 800px;
    width: 100%;
}

#announcement-table thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--secondary-navy);
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-gray);
    padding-top: 1rem;
    padding-bottom: 1rem;
    font-size: 0.95rem;
}

#announcement-table tbody tr { transition: background-color 0.15s ease-in-out; }

#announcement-table tbody td {
    vertical-align: top;
    font-size: 0.95rem;
    border-top: 1px solid var(--border-gray);
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

#announcement-table tbody tr:first-child td { border-top: none; }
#announcement-table tbody tr:hover { background-color: #f8f9fb; }

.id-cell { width: 80px; }

.table-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 32px;
    border-radius: 5px;
    font-weight: 600;
    color: var(--white);
    background-color: var(--primary-red);
}

.country-cell .country-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--dark-gray);
}

.gi-cell .gi-label {
    display: inline-block;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    background-color: #f1f5f9;
    color: var(--secondary-navy);
    border: 1px solid #cbd5e1;
    white-space: pre-wrap !important;
    word-break: break-word;
}

.gi-cell .gi-label u {
    text-decoration: underline !important;
    text-decoration-color: #7a050b !important;
    text-underline-offset: 3px !important;
    color: inherit !important;
    font-weight: inherit !important;
    background: none !important;
}

.gi-cell .gi-label em {
    font-style: italic !important;
    font-weight: inherit !important;
    background: none !important;
}

.gi-cell .gi-label s {
    text-decoration: line-through !important;
    text-decoration-color: #7a050b !important;
    font-weight: inherit !important;
    background: none !important;
}

.download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--white);
    width: 56px;
    height: 56px;
    border-radius: 10px;
    transition: background-color 0.15s, opacity 0.15s;
    border: none;
    margin: 0 auto;
}

.download-link svg { margin-right: 0; }
.download-link--eng { background-color: var(--secondary-navy); }
.download-link--th { background-color: var(--primary-red); }
.download-link:hover { opacity: 0.85; color: var(--white); }
.download-link:focus-visible { outline: 2px solid var(--secondary-navy); outline-offset: 2px; }
.download-link--disabled { background-color: #cbd5e1 !important; color: #94a3b8 !important; cursor: not-allowed; opacity: 0.6; }

/* Mobile Cards */
.mobile-card {
    background-color: var(--white);
    border: 1.5px solid var(--border-gray);
    border-radius: 10px;
    margin-bottom: 0.875rem;
    overflow: hidden;
    transition: all 0.25s ease;
}

.mobile-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); border-color: #cbd5e1; }
.mobile-card:active { transform: scale(0.99); }

.mobile-card-header {
    display: flex;
    align-items: flex-start;
    padding: 1.125rem;
    cursor: pointer;
    gap: 0.875rem;
    transition: background-color 0.2s ease;
}

.mobile-card-header:hover { background-color: #fafbfc; }

.mobile-card-badge {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-red) 0%, #a0060e 100%);
    color: var(--white);
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(122, 5, 11, 0.2);
}

.mobile-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-card-country::before {
    content: "ประเทศต้นกำเนิด";
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--medium-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.15rem;
}

.mobile-card-country {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--secondary-navy);
    line-height: 1.3;
}

.mobile-card-gi-wrapper { display: flex; flex-direction: column; gap: 0.15rem; }
.mobile-card-gi-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--medium-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-card-gi {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark-gray);
    line-height: 1.4;
    word-break: break-word;
}

.mobile-card-gi u { text-decoration: underline; text-decoration-color: var(--primary-red); text-underline-offset: 3px; }
.mobile-card-gi em { font-style: italic; }
.mobile-card-gi s { text-decoration: line-through; text-decoration-color: var(--primary-red); }

.mobile-card-toggle {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gray);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    color: var(--secondary-navy);
    transition: all 0.3s ease;
}

.mobile-card-toggle:hover { background: var(--light-gray); }
.mobile-card.expanded .mobile-card-toggle {
    transform: rotate(180deg);
    background: var(--secondary-navy);
    color: var(--white);
    border-color: var(--secondary-navy);
}

.mobile-card-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border-top: 1px solid transparent;
}

.mobile-card.expanded .mobile-card-content { border-top-color: var(--border-gray); }

.mobile-card-actions {
    padding: 1rem 1.125rem;
    display: flex;
    gap: 0.75rem;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
}

.mobile-pdf-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: none;
    border-radius: 10px;
    color: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.mobile-pdf-btn svg { width: 22px; height: 22px; }
.mobile-pdf-btn--eng { background: linear-gradient(135deg, var(--secondary-navy) 0%, #0a4a8f 100%); }
.mobile-pdf-btn--th { background: linear-gradient(135deg, var(--primary-red) 0%, #a0060e 100%); }
.mobile-pdf-btn:active:not(:disabled) { transform: scale(0.97); }
.mobile-pdf-btn:hover:not(:disabled) { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18); }
.mobile-pdf-btn--disabled { background: #e2e8f0; color: #94a3b8; cursor: not-allowed; opacity: 0.6; box-shadow: none; }

/* Tablet */
@media (max-width: 992px) {
    .header-logo { width: 70px; }
    .main-title { font-size: 1.5rem; }
    #announcement-table thead th { font-size: 0.85rem; padding: 0.75rem 0.5rem; }
    #announcement-table tbody td { font-size: 0.9rem; padding: 0.7rem 0.5rem; }
    .download-link { width: 48px; height: 48px; }
    .pdf-modal .modal-header { padding: 1.25rem 1.5rem; }
    .pdf-modal .modal-body { padding: 0.875rem 1.5rem; }
    .pdf-modal .modal-meta { gap: 1.5rem; }
}

/* Mobile */
@media (max-width: 768px) {
    .header-logo { width: 60px; }
    .desktop-view { display: none !important; }
    .mobile-view { display: block !important; }
    .container { padding: 0 1rem; }
    .main-title { font-size: 1.25rem; padding: 0.5rem 0 !important; }
    header { margin-bottom: 1rem !important; }
    #search-input { font-size: 0.95rem; }
    .table-responsive { border-radius: 6px; margin-bottom: 1rem; }
    #announcement-table thead th { font-size: 0.7rem; padding: 0.6rem 0.3rem; }
    #announcement-table tbody td { font-size: 0.8rem; padding: 0.6rem 0.3rem; }
    .table-badge { width: 32px; height: 24px; font-size: 0.75rem; }
    .country-cell .country-label { font-size: 0.85rem; }
    .gi-cell .gi-label { font-size: 0.8rem; padding: 0.2rem 0.5rem; }
    .download-link { width: 42px; height: 42px; }
    .download-link svg { width: 22px; height: 22px; }
    .pagination { font-size: 0.875rem; }
    .pagination .page-link { padding: 0.375rem 0.65rem; }
    .pdf-modal .modal-dialog { margin: 1rem !important; max-height: calc(100vh - 2rem); }
    .pdf-modal .modal-content { max-height: calc(100vh - 2rem); }
    .pdf-modal .modal-header { padding: 1rem 1.25rem; }
    .pdf-modal .modal-title { font-size: 1rem; }
    .btn-close-custom { width: 40px; height: 40px; }
    .btn-close-custom svg { width: 20px; height: 20px; }
    .modal-info-section { padding: 1rem 1.25rem; flex-direction: column; gap: 1rem; }
    .modal-info-item { min-width: 100%; }
    .modal-info-icon { width: 36px; height: 36px; }
    .modal-info-icon svg { width: 16px; height: 16px; }
    .modal-info-label { font-size: 0.7rem; }
    .modal-info-value { font-size: 0.9rem; }
    .pdf-modal .modal-body { padding: 1rem 1.25rem; }
    .pdf-frame-wrapper { max-height: calc(100vh - 300px); }
    #pdfViewer { min-height: 300px; max-height: calc(100vh - 300px); }
}

/* Small Mobile */
@media (max-width: 480px) {
    .header-logo { width: 50px; }
    .main-title { font-size: 1.1rem; }
    #announcement-table thead th { font-size: 0.65rem; padding: 0.5rem 0.2rem; }
    #announcement-table tbody td { font-size: 0.75rem; padding: 0.5rem 0.2rem; }
    .table-badge { width: 28px; height: 22px; font-size: 0.7rem; }
    .download-link { width: 38px; height: 38px; }
    .download-link svg { width: 20px; height: 20px; }
    .pdf-modal .modal-dialog { margin: 0.75rem !important; max-height: calc(100vh - 1.5rem); }
    .pdf-modal .modal-content { max-height: calc(100vh - 1.5rem); }
    .pdf-modal .modal-header { padding: 0.875rem 1rem; }
    .pdf-modal .modal-title { font-size: 0.9rem; }
    .btn-close-custom { width: 36px; height: 36px; border-width: 1.5px; }
    .btn-close-custom svg { width: 18px; height: 18px; }
    .modal-info-section { padding: 0.875rem 1rem; }
    .modal-info-icon { width: 32px; height: 32px; }
    .modal-info-icon svg { width: 14px; height: 14px; }
    .modal-info-label { font-size: 0.65rem; }
    .modal-info-value { font-size: 0.85rem; }
    .pdf-modal .modal-body { padding: 0.875rem 1rem; }
    .pdf-frame-wrapper { max-height: calc(100vh - 280px); }
    #pdfViewer { min-height: 250px; max-height: calc(100vh - 280px); }
    .mobile-card-header { padding: 0.875rem; }
    .mobile-card-badge { width: 36px; height: 36px; font-size: 0.9rem; }
    .mobile-card-info { gap: 0.4rem; }
    .mobile-card-country::before { font-size: 0.6rem; }
    .mobile-card-country { font-size: 0.95rem; }
    .mobile-card-gi-label { font-size: 0.6rem; }
    .mobile-card-gi { font-size: 0.85rem; }
    .mobile-pdf-btn { padding: 0.65rem 0.75rem; font-size: 0.85rem; }
}

.pdf-modal {
    border-radius: 12px;
    border: 1px solid var(--border-gray);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.pdf-modal .modal-dialog {
    margin: 1.75rem;
    max-height: calc(100vh - 3.5rem);
}

.pdf-modal .modal-content {
    max-height: calc(100vh - 3.5rem);
    display: flex;
    flex-direction: column;
}

.pdf-modal .modal-header {
    border-bottom: none;
    background: linear-gradient(135deg, var(--secondary-navy) 0%, #083d6e 100%);
    padding: 1.5rem 2rem;
    flex-shrink: 0;
}

.pdf-modal .modal-header-content { flex: 1; }

.pdf-modal .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    margin: 0;
}

.btn-close-custom {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: var(--white);
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
    backdrop-filter: blur(10px);
}

.btn-close-custom:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.btn-close-custom:active {
    transform: rotate(90deg) scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.btn-close-custom svg { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)); }

.modal-info-section {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-gray);
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.modal-info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}

.modal-info-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary-navy) 0%, var(--primary-red) 100%);
    border-radius: 10px;
    color: var(--white);
}

.modal-info-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.modal-info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--medium-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.modal-info-value u { text-decoration: underline; text-decoration-color: var(--primary-red); text-underline-offset: 3px; }
.modal-info-value em { font-style: italic; }
.modal-info-value s { text-decoration: line-through; text-decoration-color: var(--primary-red); }

.pdf-modal .modal-body {
    padding: 1.5rem 2rem;
    background-color: #e8edf2;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.pdf-frame-wrapper {
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 350px);
    background-color: #f8f9fa;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#pdfViewer {
    width: 100%;
    height: 100%;
    min-height: 600px;
    max-height: calc(100vh - 350px);
    border: none;
    border-radius: 8px;
}

@media (max-width: 768px) {
    #pdfViewer { min-height: 500px; }
}

.pagination { flex-wrap: wrap; gap: 0.25rem; }

.pagination .page-item .page-link {
    color: var(--secondary-navy);
    border: 1px solid var(--border-gray);
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: var(--white);
}

.pagination .page-item.disabled .page-link { color: var(--medium-gray); opacity: 0.5; }
.pagination .page-item .page-link:hover:not(.disabled) { background-color: var(--bg-gray); border-color: var(--secondary-navy); }

footer {
    background-color: var(--white) !important;
    border-top: 1px solid var(--border-gray);
}

/* Disclaimer Text */
.disclaimer-text, .disclaimer-top {
    text-align: left;
    /* max-width: 900px; */
    margin: 0 auto 1rem auto;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--border-gray);
}

.disclaimer-text p, .disclaimer-top p { margin-bottom: 0.5rem; font-size: 0.9rem; line-height: 1.6; }
.disclaimer-text p:first-child, .disclaimer-top p:first-child { margin-bottom: 0.75rem; }
.disclaimer-text p:last-child, .disclaimer-top p:last-child { margin-bottom: 0; }
.disclaimer-text a, .disclaimer-top a { color: var(--secondary-navy); text-decoration: underline; }
.disclaimer-text a:hover, .disclaimer-top a:hover { color: var(--primary-red); }

/* Mobile Card Details */
.mobile-card-details {
    padding: 0.75rem 1.125rem;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-gray);
}

.mobile-card-details small {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: var(--secondary-navy);
    font-weight: 500;
}

.mobile-card-details small:last-child { margin-bottom: 0; }
