/* ===== CSS Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ===== Login Layout ===== */
.login-layout {
    display: flex;
    gap: 40px;
    width: 100%;
    max-width: 1100px;
    max-height: calc(100vh - 4rem);
    align-items: stretch;
}

/* ===== Visual/News Section (Left) ===== */
.login-visual {
    flex: 1;
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    position: relative;
    min-height: 0;
}

.login-visual-title {
    display: none;
}

.login-visual-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ===== News Module ===== */
.news-module {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

.news-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.news-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
}

.module-badge {
    display: none;
}

.news-pill {
    display: none;
}

.news-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-height: 0;
    max-height: 560px;
    overflow-y: auto;
}


.news-grid::-webkit-scrollbar {
    width: 4px;
}

.news-grid::-webkit-scrollbar-track {
    background: transparent;
}

.news-grid::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

/* ===== News Card ===== */
.news-card {
    background: #fafafa;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.news-card:hover {
    background: #fff;
    border-color: #eee;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.news-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
    line-height: 1.4;
}

.news-card p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-card-actions {
    display: flex;
    align-items: center;
}

.news-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #fff0f0;
    color: #c41e3a;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    width: fit-content;
}

.news-tag.soft {
    background: #f0f7ff;
    color: #2563eb;
}

.news-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #999;
}

/* ===== Login Panel (Right) ===== */
.login-panel {
    width: 400px;
    min-width: 400px;
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.brand-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    width: 90px;
    height: auto;
    object-fit: contain;
}

/* ===== Form Elements ===== */
.form-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Kanit', sans-serif;
    background: #fafafa;
    transition: all 0.2s ease;
    color: #1a1a1a;
}

.form-control::placeholder {
    color: #aaa;
}

.form-control:hover {
    border-color: #ccc;
}

.form-control:focus {
    outline: none;
    border-color: #9b0f16;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(155, 15, 22, 0.08);
}

/* Remember me */
.remember {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #666;
}

.remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #9b0f16;
    cursor: pointer;
}

.remember label {
    cursor: pointer;
}

/* ===== Buttons ===== */
.button-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Kanit', sans-serif;
    text-align: center;
}

.btn-primary {
    background: #9b0f16;
    color: white;
}

.btn-primary:hover {
    background: #7d0c12;
}

.btn-outline {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.btn-outline:hover {
    border-color: #9b0f16;
    color: #9b0f16;
}

.btn-ms {
    background: #fff;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid #e5e5e5;
    width: 100%;
    padding: 14px 24px;
    font-weight: 500;
}

.btn-ms:hover {
    background: #f9f9f9;
    border-color: #ccc;
}

.btn-ms img {
    width: 20px;
    height: 20px;
}

/* Forgot password link */
.forgot {
    font-size: 0.9rem;
    color: #999;
    text-decoration: none;
    transition: color 0.2s ease;
}

.forgot:hover {
    color: #9b0f16;
}

/* ===== Button Icons (News cards) ===== */
.btn-icon {
    border: none;
    background: transparent;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #9b0f16;
    transition: all 0.2s ease;
    font-family: 'Kanit', sans-serif;
    border-radius: 8px;
}

.btn-icon:hover {
    background: #fff0f0;
}

.btn-icon.edit {
    color: #9b0f16;
    background: transparent;
}

.btn-icon.edit:hover {
    background: #fff0f0;
}

.btn-icon.cancel {
    color: #666;
}

/* ===== News Detail Modal ===== */
.news-detail-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 400;
}

.news-detail-modal.show {
    display: flex;
}

.news-detail-box {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: grid;
    gap: 16px;
}

.news-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.news-detail-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
}

.news-detail-body {
    color: #555;
    line-height: 1.7;
    white-space: pre-wrap;
}

.news-detail-summary {
    color: #666;
    font-size: 0.95rem;
}

.news-detail-status {
    font-size: 0.85rem;
    color: #999;
}

/* News Detail Hero & Gallery */
.news-detail-hero {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.news-detail-hero .hero-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.news-body-gallery {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    margin: 8px 0;
    min-height: 200px;
    background: #f5f5f5;
}

.gallery-track {
    display: grid;
}

.gallery-slide {
    width: 100%;
    height: 280px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: none;
    background-color: #f5f5f5;
}

.gallery-slide.active {
    display: block;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.gallery-nav.prev {
    left: 10px;
}

.gallery-nav.next {
    right: 10px;
}

.gallery-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.gallery-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.gallery-dots .dot.active {
    background: #9b0f16;
}

.gallery-expand {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.news-body-gallery.fullscreen {
    position: fixed;
    inset: 20px;
    z-index: 900;
    background: #1a1a1a;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.news-body-gallery.fullscreen .gallery-track {
    width: 100%;
    height: 100%;
    display: block;
}

.news-body-gallery.fullscreen .gallery-slide {
    height: 100%;
    width: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #fff;
}

/* Attachments */
.news-detail-attachments {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.att-section {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 14px;
}

.att-title {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.att-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ===== Landing Page ===== */
.landing-container {
    background: #fff;
    border-radius: 20px;
    padding: 3rem;
    max-width: 1100px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.landing-header {
    text-align: center;
    margin-bottom: 3rem;
}

.landing-header h1 {
    font-size: 2rem;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.landing-header p {
    color: #666;
    font-size: 1rem;
}

.user-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: #fafafa;
    border-radius: 14px;
    margin-bottom: 2rem;
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: #9b0f16;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

.user-details h3 {
    color: #1a1a1a;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.user-details p {
    color: #666;
    font-size: 0.85rem;
}

.btn-logout {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Kanit', sans-serif;
}

.btn-logout:hover {
    background: #dc2626;
}

/* Module Grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.module-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.module-card:hover {
    border-color: #9b0f16;
    box-shadow: 0 8px 24px rgba(155, 15, 22, 0.08);
}

.module-icon {
    width: 64px;
    height: 64px;
    background: #9b0f16;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
    margin: 0 auto 1rem;
}

.module-card h3 {
    font-size: 1.15rem;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.module-card p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.badge {
    display: inline-block;
    background: #10b981;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.coming-soon {
    background: #f59e0b;
}

.module-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-card.disabled:hover {
    border-color: #eee;
    box-shadow: none;
}

/* ===== Notification ===== */
#notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    display: none;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

#notification.show {
    display: flex;
}

#notification.error {
    border-left: 3px solid #ef4444;
}

#notification.success {
    border-left: 3px solid #10b981;
}

@keyframes slideIn {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Mobile Responsiveness ===== */
@media (max-width: 900px) {
    .login-layout {
        flex-direction: column-reverse;
        gap: 24px;
        max-width: 440px;
        max-height: none;
    }

    .login-visual {
        width: 100%;
    }

    .login-panel {
        width: 100%;
        min-width: unset;
        max-height: none;
        overflow: visible;
    }

    .news-grid {
        max-height: 280px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1rem;
    }

    .login-panel {
        padding: 32px 24px;
    }

    .login-visual {
        padding: 20px;
    }

    .form-control {
        font-size: 16px;
    }
}

/* ===== Language Selector Dropdown ===== */
.lang-dropdown {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
}

.lang-dropdown-toggle {
    background: #fff;
    border: 1px solid #e5e5e5;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Kanit', sans-serif;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.lang-dropdown-toggle:hover {
    border-color: #9b0f16;
    color: #9b0f16;
}

.lang-dropdown-toggle i {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    min-width: 140px;
    overflow: hidden;
}

.lang-dropdown-menu.show {
    display: flex;
}

.lang-option {
    background: none;
    border: none;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.85rem;
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
    transition: background 0.15s ease;
    color: #333;
}

.lang-option:hover {
    background: #f5f5f5;
}

.lang-option:not(:last-child) {
    border-bottom: 1px solid #eee;
}

@media (max-width: 480px) {
    .lang-dropdown {
        top: 8px;
        right: 8px;
    }

    .lang-dropdown-toggle {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}
