/* ============================================
   NEWS DETAIL PAGE - COMPREHENSIVE STYLING
   รองรับทุก HTML Elements จาก WYSIWYG Editor
   ============================================ */

/* Prevent horizontal overflow on all devices */
* {
    box-sizing: border-box;
}

/* ============================================
   CONTAINER LAYOUT - Single Column
   ============================================ */
.news-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ============================================
   ARTICLE SECTION
   ============================================ */
.news-detail-article {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
    border-radius: 20px;
    border: 2px solid rgba(212, 175, 55, 0.2);
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Header */
.news-header {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.2);
}

.news-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-title {
    font-size: 36px;
    font-weight: 800;
    color: #fbbf24;
    margin: 0 0 15px 0;
    line-height: 1.3;
    text-shadow: 0 2px 10px rgba(251, 191, 36, 0.3);
}

.news-description {
    font-size: 18px;
    color: #cbd5e1;
    line-height: 1.6;
    margin: 15px 0 20px 0;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 4px solid #fbbf24;
    border-radius: 8px;
}

.news-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: #94a3b8;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item i {
    color: #fbbf24;
}

/* Keywords Tags - Footer Placement */
.news-keywords {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.news-keywords i {
    color: #fbbf24;
    font-size: 16px;
}

.keyword-tag {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 20px;
    color: #fbbf24;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    cursor: default;
}

.keyword-tag:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.5);
    transform: translateY(-2px);
}

/* Featured Image */
.news-featured-image {
    margin-bottom: 40px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.news-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   CONTENT WRAPPER - รองรับ WYSIWYG Content
   ============================================ */
.news-content-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 40px;
    overflow-x: hidden;
    width: 100%;
}

.news-content {
    font-size: 16px;
    line-height: 1.8;
    color: #e2e8f0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    /* Content container centered, but text left-aligned */
}

/* Headings */
.news-content h1,
.news-content h2,
.news-content h3,
.news-content h4,
.news-content h5,
.news-content h6 {
    color: #fbbf24;
    font-weight: 700;
    margin: 30px 0 15px 0;
    line-height: 1.3;
}

.news-content h1 {
    font-size: 32px;
    border-bottom: 3px solid rgba(251, 191, 36, 0.3);
    padding-bottom: 10px;
}

.news-content h2 {
    font-size: 28px;
    border-bottom: 2px solid rgba(251, 191, 36, 0.2);
    padding-bottom: 8px;
}

.news-content h3 {
    font-size: 24px;
}

.news-content h4 {
    font-size: 20px;
}

.news-content h5 {
    font-size: 18px;
}

.news-content h6 {
    font-size: 16px;
}

/* Paragraphs */
.news-content p {
    margin: 15px 0;
    /* No forced alignment - let content control it */
}

/* Prevent unwanted word breaks in paragraphs */
.news-content p br {
    display: block;
    content: "";
    margin: 0;
}

/* Strong/Bold */
.news-content strong,
.news-content b {
    color: #fbbf24;
    font-weight: 700;
}

/* Emphasis/Italic */
.news-content em,
.news-content i {
    font-style: italic;
    color: #cbd5e1;
}

/* Underline */
.news-content u {
    text-decoration: underline;
    text-decoration-color: #fbbf24;
}

/* Links */
.news-content a {
    color: #60a5fa;
    text-decoration: none;
    border-bottom: 1px solid rgba(96, 165, 250, 0.3);
    transition: all 0.3s;
}

.news-content a:hover {
    color: #93c5fd;
    border-bottom-color: #93c5fd;
}

/* Lists */
.news-content ul,
.news-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.news-content ul {
    list-style-type: disc;
}

.news-content ol {
    list-style-type: decimal;
}

.news-content li {
    margin: 10px 0;
    line-height: 1.6;
    color: #cbd5e1;
}

.news-content li::marker {
    color: #fbbf24;
}

/* Nested Lists */
.news-content ul ul,
.news-content ol ol,
.news-content ul ol,
.news-content ol ul {
    margin: 10px 0;
}

/* Tables - Basic styling only, let content control specifics */
.news-content table {
    border-collapse: collapse;
    margin: 25px 0;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: table;
    width: 100%;
}

/* Table wrapper for responsive scroll */
.news-content .table-wrapper {
    overflow-x: auto;
    margin: 25px 0;
    border-radius: 12px;
}

.news-content thead th {
    /* Most properties removed to allow inline styles */
    font-weight: 700;
    white-space: normal;
    word-wrap: break-word;
}

.news-content tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
}

.news-content tbody tr:hover {
    background: rgba(251, 191, 36, 0.1);
}

.news-content tbody tr:last-child {
    border-bottom: none;
}

.news-content td,
.news-content th {
    /* Most properties removed to allow inline styles */
    white-space: normal;
    word-wrap: break-word;
}

/* Blockquote */
.news-content blockquote {
    margin: 25px 0;
    padding: 20px 25px;
    background: rgba(96, 165, 250, 0.1);
    border-left: 5px solid #60a5fa;
    border-radius: 8px;
    font-style: italic;
    color: #93c5fd;
}

.news-content blockquote p {
    margin: 0;
}

/* Code */
.news-content code {
    background: rgba(0, 0, 0, 0.5);
    color: #86efac;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.news-content pre {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
}

.news-content pre code {
    background: none;
    padding: 0;
    color: #86efac;
}

/* Images - Basic properties only, let content control specifics */
.news-content img {
    max-width: 100%;
    height: auto;
    /* Removed: display, margin, border-radius, box-shadow */
    /* These should be controlled by inline styles in content */
}

/* Horizontal Rule */
.news-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.5), transparent);
    margin: 30px 0;
}

/* Text Alignment */
.news-content .text-left {
    text-align: left;
}

.news-content .text-center {
    text-align: center;
}

.news-content .text-right {
    text-align: right;
}

.news-content .text-justify {
    text-align: justify;
}

/* ============================================
   TAILWIND & INLINE STYLES SUPPORT
   รองรับ Summernote และ WYSIWYG Editors
   ============================================ */

/* Note: Inline styles and Tailwind classes are preserved automatically */

/* Tailwind Lists */
.news-content .list-disc {
    list-style-type: disc !important;
}

.news-content .pl-5 {
    padding-left: 1.25rem !important;
}

.news-content .space-y-2>*+* {
    margin-top: 0.5rem !important;
}

/* Tailwind Tables */
.news-content .min-w-full {
    min-width: 100% !important;
}

.news-content .overflow-x-auto {
    overflow-x: auto !important;
}

.news-content .whitespace-nowrap {
    white-space: nowrap !important;
}

/* Tailwind Hover States */
.news-content .hover\:bg-gray-100:hover {
    background-color: rgb(243, 244, 246) !important;
}



/* Prose class support (Tailwind Typography) */
.news-content .prose {
    max-width: none !important;
}

.news-content .max-w-none {
    max-width: none !important;
}

.news-content .leading-relaxed {
    line-height: 1.625 !important;
}

.news-content .leading-normal {
    line-height: 1.5 !important;
}

/* Color Support - Preserve inline styles from editor */
.news-content [style*="background-color"] {
    padding: 2px 6px;
    border-radius: 4px;
}

/* Force centering for divs with inline styles */
.news-content>div[style] {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Ensure grid and flex containers are centered */
.news-content div[style*="display: grid"],
.news-content div[style*="display: flex"] {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ============================================
   NEWS NAVIGATION - Previous/Next (News Card Style)
   ============================================ */
.news-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.nav-item {
    display: block;
    background: #0f172a;
    border: 1px solid #1f2937;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-item:not(.nav-disabled):hover {
    transform: translateY(-4px);
    border-color: #334155;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.35);
}

.nav-disabled {
    opacity: 0;
    pointer-events: none;
}

.nav-direction {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #fbbf24;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-prev .nav-direction {
    justify-content: flex-start;
}

.nav-next .nav-direction {
    justify-content: flex-end;
}

.nav-direction i {
    font-size: 11px;
}

.nav-content {
    display: flex;
    gap: 16px;
    padding: 16px;
    align-items: flex-start;
}

.nav-prev .nav-content {
    flex-direction: row;
}

.nav-next .nav-content {
    flex-direction: row-reverse;
}

.nav-thumb {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.nav-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-item:hover .nav-thumb::after {
    opacity: 1;
}

.nav-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.nav-item:hover .nav-thumb img {
    transform: scale(1.08);
}

.nav-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s;
}

.nav-item:hover .nav-title {
    color: #fbbf24;
}

.nav-prev .nav-title {
    text-align: left;
}

.nav-next .nav-title {
    text-align: right;
}

/* ============================================
   FOOTER SECTION
   ============================================ */
.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 2px solid rgba(212, 175, 55, 0.2);
}

.news-share {
    display: flex;
    align-items: center;
    gap: 15px;
}

.share-label {
    color: #94a3b8;
    font-weight: 600;
    font-size: 14px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
}

.share-facebook {
    background: #1877f2;
}

.share-facebook:hover {
    background: #145dbf;
    transform: translateY(-3px);
}

.share-twitter {
    background: #1da1f2;
}

.share-twitter:hover {
    background: #1a8cd8;
    transform: translateY(-3px);
}

.share-link {
    background: #64748b;
}

.share-link:hover {
    background: #475569;
    transform: translateY(-3px);
}

.btn-back-footer {
    padding: 12px 24px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1e293b;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-back-footer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
}

/* ============================================
   NOT FOUND PAGE
   ============================================ */
.news-not-found {
    max-width: 600px;
    margin: 100px auto;
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
    border-radius: 20px;
    border: 2px solid rgba(212, 175, 55, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.not-found-icon {
    font-size: 80px;
    color: #fbbf24;
    margin-bottom: 20px;
}

.news-not-found h2 {
    font-size: 32px;
    color: #fbbf24;
    margin: 0 0 15px 0;
}

.news-not-found p {
    color: #94a3b8;
    font-size: 16px;
    margin: 0 0 30px 0;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1e293b;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-back:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.4);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .news-detail-container {
        max-width: 100%;
        padding: 30px 20px;
    }

    .news-detail-article {
        padding: 30px 25px;
    }
}

/* Mobile */
@media (max-width: 768px) {

    /* Force all containers to fit screen */
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    .news-detail-container {
        padding: 15px 10px !important;
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    .news-detail-article {
        padding: 20px 12px !important;
        border-radius: 16px;
        max-width: 100% !important;
    }

    /* Override ALL grid layouts to single column */
    .news-content [style*="display: grid"],
    .news-content [style*="grid-template-columns"],
    div[style*="display: grid"],
    div[style*="grid-template-columns"] {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    /* Override ALL flex layouts */
    .news-content [style*="display: flex"],
    div[style*="display: flex"] {
        display: block !important;
        flex-direction: column !important;
    }

    /* Force all direct children to full width */
    .news-content>*,
    .news-content [style*="display: grid"]>*,
    .news-content [style*="display: flex"]>* {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Header */
    .news-category-badge {
        font-size: 11px !important;
        padding: 5px 10px !important;
    }

    .news-title {
        font-size: 20px !important;
        line-height: 1.3 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    .news-description {
        font-size: 14px !important;
        padding: 10px 12px !important;
    }

    .news-meta {
        gap: 10px !important;
        font-size: 12px !important;
        flex-wrap: wrap !important;
    }

    /* Keywords */
    .news-keywords {
        gap: 6px !important;
        margin-top: 12px !important;
        padding-top: 12px !important;
        flex-wrap: wrap !important;
    }

    .news-keywords i {
        font-size: 13px !important;
    }

    .keyword-tag {
        font-size: 11px !important;
        padding: 4px 10px !important;
    }

    /* Featured Image */
    .news-featured-image {
        margin-bottom: 20px !important;
        border-radius: 10px !important;
        max-width: 100% !important;
    }

    .news-featured-image img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Content */
    .news-content-wrapper {
        padding: 12px 10px !important;
        border-radius: 10px !important;
        margin-bottom: 25px !important;
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    .news-content {
        font-size: 14px !important;
        line-height: 1.6 !important;
        max-width: 100% !important;
    }

    .news-content h1 {
        font-size: 20px !important;
        word-wrap: break-word !important;
    }

    .news-content h2 {
        font-size: 18px !important;
        word-wrap: break-word !important;
    }

    .news-content h3 {
        font-size: 16px !important;
        word-wrap: break-word !important;
    }

    .news-content h4 {
        font-size: 15px !important;
    }

    .news-content p {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Tables - Keep as table but make scrollable */
    .news-content table {
        font-size: 12px !important;
        display: table !important;
        width: 100% !important;
        max-width: 100% !important;
        table-layout: auto !important;
    }

    /* Table wrapper for mobile scroll */
    .news-content .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 15px 0 !important;
    }

    .news-content thead th {
        padding: 10px 8px !important;
        font-size: 12px !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    .news-content td {
        padding: 8px !important;
        font-size: 12px !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    /* Images in content */
    .news-content img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Divs with padding/margin */
    .news-content div[style*="padding"],
    .news-content div[style*="margin"] {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* News Navigation - Stack vertically with news-card style */
    .news-navigation {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        margin-bottom: 30px !important;
    }

    .nav-direction {
        padding: 10px 14px !important;
        font-size: 11px !important;
    }

    .nav-content {
        padding: 14px !important;
        gap: 12px !important;
    }

    .nav-thumb {
        width: 90px !important;
        height: 90px !important;
    }

    .nav-title {
        font-size: 14px !important;
        line-height: 1.4 !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
    }

    /* Always align left on mobile */
    .nav-next .nav-title {
        text-align: left !important;
    }

    .nav-next .nav-content {
        flex-direction: row !important;
    }

    .nav-next .nav-direction {
        justify-content: flex-start !important;
        flex-direction: row-reverse !important;
    }

    /* Footer */
    .news-footer {
        flex-direction: column !important;
        gap: 15px !important;
        padding-top: 15px !important;
    }

    .news-share {
        width: 100% !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
    }

    .share-label {
        font-size: 12px !important;
    }

    .share-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 14px !important;
    }

    .btn-back-footer {
        width: 100% !important;
        justify-content: center !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .news-detail-container {
        padding: 15px 10px;
    }

    .news-detail-article {
        padding: 20px 15px;
    }

    /* Header */
    .news-header {
        margin-bottom: 25px;
        padding-bottom: 20px;
    }

    .news-category-badge {
        font-size: 11px;
        padding: 5px 10px;
        margin-bottom: 15px;
    }

    .news-title {
        font-size: 20px;
        line-height: 1.3;
    }

    .news-description {
        font-size: 14px;
        padding: 10px 12px;
        margin: 12px 0 15px 0;
    }

    .news-meta {
        gap: 12px;
        font-size: 12px;
    }

    .meta-item {
        gap: 4px;
    }

    /* Keywords */
    .news-keywords {
        gap: 6px;
        margin-top: 12px;
        padding-top: 12px;
    }

    .keyword-tag {
        font-size: 11px;
        padding: 4px 10px;
    }

    /* Featured Image */
    .news-featured-image {
        margin-bottom: 20px;
        border-radius: 10px;
    }

    /* Content */
    .news-content-wrapper {
        padding: 15px 12px;
        margin-bottom: 25px;
    }

    .news-content {
        font-size: 14px;
        line-height: 1.6;
    }

    .news-content h1 {
        font-size: 20px;
        padding-bottom: 8px;
    }

    .news-content h2 {
        font-size: 18px;
        padding-bottom: 6px;
    }

    .news-content h3 {
        font-size: 16px;
    }

    .news-content h4 {
        font-size: 15px;
    }

    .news-content p {
        margin: 12px 0;
    }

    .news-content ul,
    .news-content ol {
        padding-left: 20px;
        margin: 15px 0;
    }

    .news-content li {
        margin: 8px 0;
    }

    .news-content table {
        font-size: 11px;
    }

    .news-content thead th {
        padding: 8px 6px;
        font-size: 11px;
    }

    .news-content td {
        padding: 6px;
    }

    .news-content blockquote {
        padding: 15px 18px;
        margin: 20px 0;
    }

    .news-content img {
        margin: 20px 0;
        border-radius: 10px;
    }

    /* Footer */
    .news-footer {
        padding-top: 15px;
    }

    .share-label {
        font-size: 12px;
    }

    .share-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .btn-back-footer {
        font-size: 14px;
        padding: 10px 16px;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .news-title {
        font-size: 18px;
    }

    .news-content {
        font-size: 13px;
    }

    .news-content h1 {
        font-size: 18px;
    }

    .news-content h2 {
        font-size: 16px;
    }

    .news-content table {
        font-size: 10px;
    }

    .keyword-tag {
        font-size: 10px;
        padding: 3px 8px;
    }
}