/* Custom styles for Dashboard - โทนสีการประชาสัมพันธ์ */

/* โทนสีหลัก: น้ำเงิน (#2563eb), เขียว (#10b981), ส้ม (#f97316), ม่วง (#7c3aed) */

* {
    box-sizing: border-box;
}

/* Typography - ตัวอักษรภาษาไทย */
body {
    font-family: 'Sarabun', 'Kanit', 'Segoe UI', 'Sukhumvit Set', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    line-height: 1.7;
    color: #1e293b;
    background-color: #f8fafc;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Kanit', 'Sarabun', sans-serif;
    font-weight: 600;
    line-height: 1.4;
    color: #0f172a;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
}

h5 {
    font-size: 1.125rem;
    font-weight: 600;
}

h6 {
    font-size: 1rem;
    font-weight: 600;
}

/* Paragraph */
p {
    font-size: 1rem;
    line-height: 1.7;
    color: #475569;
    margin-bottom: 1rem;
}

/* Links */
a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #1e40af;
}

/* Responsive Typography */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(37, 99, 235, 0.08);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    transition: transform 0.3s ease;
}

.sidebar .nav-link {
    font-family: 'Kanit', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
}

@media (max-width: 767.98px) {
    .sidebar {
        top: 5rem;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Mobile overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Close button for mobile */
    .sidebar .btn-close {
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0.8;
        transition: opacity 0.3s ease;
    }
    
    .sidebar .btn-close:hover {
        opacity: 1;
    }
}

.sidebar .nav-link {
    font-weight: 500;
    color: #334155;
    transition: all 0.3s ease;
    padding: 0.75rem 1.25rem;
    margin: 0.25rem 0.5rem;
    border-radius: 10px;
}

.sidebar .nav-link:hover {
    color: #1e40af;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 3px solid #3b82f6;
    padding-left: calc(1.25rem - 3px);
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    color: #1e40af;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 3px solid #2563eb;
    padding-left: calc(1.25rem - 3px);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
}

.navbar-brand {
    padding-top: .75rem;
    padding-bottom: .75rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.news-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 1.5rem;
    height: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    background: #ffffff;
    position: relative;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(30, 64, 175, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.news-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.25);
    border-color: #3b82f6;
}

.news-card:hover::before {
    opacity: 1;
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    transition: transform 0.4s ease;
}

.news-card:hover .news-image {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .news-card {
        margin-bottom: 1rem;
    }
    
    .news-image {
        height: 180px;
    }
}

.badge-priority {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
}

.card-body {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    padding: 1.5rem;
}

.card-title {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    font-size: 1.125rem;
    line-height: 1.5;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.card-text {
    flex-grow: 1;
    color: #64748b;
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* สีสำหรับสถิติ */
.stat-card-primary,
.stat-card-success,
.stat-card-info,
.stat-card-warning {
    border: none;
    border-radius: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card-primary .card-title,
.stat-card-success .card-title,
.stat-card-info .card-title,
.stat-card-warning .card-title {
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.75rem;
}

.stat-card-primary h2,
.stat-card-success h2,
.stat-card-info h2,
.stat-card-warning h2 {
    font-family: 'Kanit', sans-serif;
    font-weight: 700;
    font-size: 2.25rem;
    color: #ffffff;
    margin-bottom: 0;
}

.stat-card-primary::before,
.stat-card-success::before,
.stat-card-info::before,
.stat-card-warning::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card-primary:hover::before,
.stat-card-success:hover::before,
.stat-card-info:hover::before,
.stat-card-warning:hover::before {
    opacity: 1;
}

.stat-card-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1e40af 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.stat-card-primary:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.stat-card-success {
    background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.stat-card-success:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.stat-card-info {
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 50%, #6d28d9 100%);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
}

.stat-card-info:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

.stat-card-warning {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}

.stat-card-warning:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4);
}

/* Responsive สำหรับสถิติ */
@media (max-width: 768px) {
    .stat-card-primary,
    .stat-card-success,
    .stat-card-info,
    .stat-card-warning {
        margin-bottom: 1rem;
    }
    
    .stat-card-primary .card-body,
    .stat-card-success .card-body,
    .stat-card-info .card-body,
    .stat-card-warning .card-body {
        padding: 1rem;
    }
    
    .stat-card-primary h2,
    .stat-card-success h2,
    .stat-card-info h2,
    .stat-card-warning h2 {
        font-size: 1.5rem;
    }
}

/* Navbar สีการประชาสัมพันธ์ */
.navbar-dark.bg-dark {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%) !important;
    box-shadow: 0 4px 16px rgba(30, 64, 175, 0.25);
    padding: 0.875rem 0;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-family: 'Kanit', sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: 0.5px;
}

.navbar-nav .nav-link {
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 0.25rem;
    padding: 0.5rem 1rem !important;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Badge หมวดหมู่ */
.badge.bg-secondary {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.badge-priority {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
}

/* Responsive Typography */
@media (max-width: 576px) {
    h1.h2 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
}

/* Loading Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card,
.stat-card-primary,
.stat-card-success,
.stat-card-info,
.stat-card-warning {
    animation: fadeInUp 0.6s ease-out;
}

.news-card:nth-child(1) { animation-delay: 0.1s; }
.news-card:nth-child(2) { animation-delay: 0.2s; }
.news-card:nth-child(3) { animation-delay: 0.3s; }
.news-card:nth-child(4) { animation-delay: 0.4s; }
.news-card:nth-child(5) { animation-delay: 0.5s; }
.news-card:nth-child(6) { animation-delay: 0.6s; }

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Main Content Responsive */
main {
    padding: 1rem;
    background-color: #f8fafc;
    min-height: calc(100vh - 56px);
}

@media (min-width: 768px) {
    main {
        padding: 2rem 2.5rem;
    }
}

/* Badge Improvements */
.badge {
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
}

.badge-priority {
    font-weight: 600;
    font-size: 0.875rem;
}

/* Button Improvements */
.btn {
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 0.5rem 1.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Alert Improvements */
.alert {
    border-radius: 16px;
    border: none;
    padding: 1.25rem 1.5rem;
    animation: fadeInUp 0.4s ease-out;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.alert-heading {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

/* Card Body Improvements */
.card-body {
    padding: 1.5rem;
}

@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
}

/* Image Responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Container Improvements */
.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 768px) {
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Navbar Responsive */
@media (max-width: 576px) {
    .navbar-brand {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem;
    }
}

/* Card Responsive Improvements */
@media (max-width: 576px) {
    .card-body {
        padding: 0.75rem;
    }
    
    .card-title {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .card-text {
        font-size: 0.8125rem;
    }
}

/* Image Loading */
.news-image {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-image::before {
    content: '📰';
    font-size: 3rem;
    opacity: 0.3;
    position: absolute;
}

.news-image[src]::before {
    display: none;
}

/* Touch Improvements for Mobile */
@media (hover: none) and (pointer: coarse) {
    .news-card:hover {
        transform: none;
    }
    
    .news-card:active {
        transform: scale(0.98);
    }
    
    .btn:active {
        transform: scale(0.95);
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .btn-toolbar {
        display: none !important;
    }
    
    main {
        margin: 0 !important;
        padding: 0 !important;
    }
}

