/* wwwroot/css/app.css */

/* === CSS Variables === */
:root {
    --primary-color: #9b59b6;
    --primary-dark: #8e44ad;
    --primary-light: #bb8fce;
    --accent-color: #e8daef;
    --text-color: #333;
    --light-bg: #faf5ff;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(155, 89, 182, 0.1);
    --transition: all 0.3s ease;
    --gradient: linear-gradient(135deg, #bb8fce, #9b59b6);
    --danger-color: #dc3545;
}

/* === Reset and Base Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', 'Sarabun', sans-serif;
}

body {
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* === Main App Container === */
.app-container {
    .app-container {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        width: 100vw;
        /* ให้กว้างเท่า viewport width */
        max-width: none;
        /* ยกเลิกการจำกัด max-width ใดๆ */
    }
}

.main-content {
    flex-grow: 1;
    /* ทำให้เนื้อหาหลักขยายเต็มพื้นที่ที่เหลือ */
    max-width: 1200px;
    /* จำกัดความกว้างสูงสุดของเนื้อหา */
    margin: 0 auto;
    /* จัดกลางเนื้อหา */
    padding: 2rem;
    /* ระยะห่างจากขอบด้านใน */
}

/* === Page Title Section === */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.page-subtitle {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* === General Card Styles === */
/* --- Card Section --- */
.card {
    background-color: var(--white);
    border-radius: 15px;
    box-shadow: var(--shadow);
    padding: 2.5rem !important;
    /* เพิ่ม padding ขึ้นเล็กน้อย */
    margin-bottom: 2rem;
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(155, 89, 182, 0.15);
}

.card-title {
    font-size: 1.8rem;
    /* เพิ่มขนาดหัวข้อ */
    margin-bottom: 1.8rem;
    /* เพิ่มระยะห่างด้านล่าง */
    color: var(--primary-color);
    font-weight: 600;
    text-align: center;
    /* เพิ่มเพื่อให้หัวข้ออยู่กลาง */
}

/* === Grid Layout for Cards === */
.grid-cards {
    display: grid;
    /* Desktop Default: 300px min-width, auto-fill */
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    /* เพิ่ม minwidth อีกนิด */
    gap: 2rem;
    justify-content: center;
    align-items: stretch;
}

/* === Stat Cards (can be used within grid-cards) === */
.stat-card {
    text-align: center;
    padding: 2.5rem;
    /* เพิ่ม padding ภายใน stat-card */
    background: var(--gradient);
    color: white;
    border-radius: 15px;
    transition: var(--transition);
    display: flex;
    /* เพิ่ม display: flex */
    flex-direction: column;
    /* จัดเรียงแนวตั้ง */
    justify-content: center;
    /* จัดกลางเนื้อหาในแนวตั้ง */
    align-items: center;
    /* จัดกลางเนื้อหาในแนวนอน */
}

.stat-card:hover {
    transform: scale(1.05);
}

.stat-number {
    font-size: 3.5rem;
    /* เพิ่มขนาดตัวเลขให้ใหญ่ขึ้น */
    font-weight: 700;
    margin-bottom: 0.8rem;
    /* เพิ่มระยะห่าง */
    line-height: 1.2;
}

.stat-label {
    font-size: 1.25rem;
    /* เพิ่มขนาดข้อความด้านล่าง */
    opacity: 0.9;
    line-height: 1.4;
}

/* === Feature Boxes === */
.feature-box {
    display: flex;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: rgba(232, 218, 239, 0.3);
    border-radius: 15px;
    transition: var(--transition);
}

.feature-box:hover {
    background-color: rgba(232, 218, 239, 0.5);
    transform: translateX(10px);
}

.feature-icon {
    flex: 0 0 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    font-size: 1.8rem;
    margin-right: 1.5rem;
}

.feature-content {
    flex: 1;
}

.feature-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.feature-text {
    color: #666;
    line-height: 1.6;
}

/* === General Buttons === */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--gradient);
    color: white;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 1rem;
    text-align: center;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(155, 89, 182, 0.3);
}

/* === Hero Section === */
.hero-section {
    background: var(--gradient);
    color: white;
    border-radius: 20px;
    padding: 4rem;
    margin-bottom: 3rem;
    /* ตรวจสอบค่านี้ ถ้าถูกขีดทับ */
    position: relative;
    overflow: hidden;
    text-align: center;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    /* ตรวจสอบค่านี้ ถ้าถูกขีดทับ */
    margin: 0 auto;
    /* ตรวจสอบค่านี้ ถ้าถูกขีดทับ */
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.hero-text {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    line-height: 1.7;
}

.hero-shape {
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.hero-shape:before {
    content: '';
    position: absolute;
    top: -80px;
    left: -80px;
    width: 250px;
    height: 250px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* === Login Layout === */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background-color: var(--light-bg);
}

.login-wrapper {
    display: flex;
    width: 1000px;
    max-width: 100%;
    height: 600px;
    max-height: 100vh;
    background-color: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.mb-3.d-flex.align-items-center .form-control {
    max-width: 300px;
    /* Limit width of search input */
}

/* Custom styles for the Innovation Type Management page */

/* Search input and button alignment */
.mb-3.d-flex.align-items-center .form-control {
    max-width: 300px;
    /* Limit width of search input */
}

/* Modern Table Styles (should be applied via SharedTable or directly) */
.modern-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    /* Subtle shadow for the table */
    border-radius: 8px;
    /* Rounded corners for the table */
    overflow: hidden;
    /* Ensures rounded corners are visible */
}

.modern-table thead {
    background-color: #f8f9fa;
    /* Light grey header background */
    border-bottom: 2px solid #e0e0e0;
}

.modern-table th {
    padding: 1rem 1.2rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    /* Prevent wrapping for headers */
}

.modern-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    /* Light border between rows */
    transition: background-color 0.2s ease-in-out;
}

.modern-table tbody tr:last-child {
    border-bottom: none;
    /* No border for the last row */
}

.modern-table tbody tr:hover {
    background-color: #f1f3f4;
    /* Subtle hover effect */
}

.modern-table td {
    padding: 0.9rem 1.2rem;
    vertical-align: middle;
    /* Align content vertically */
    color: #343a40;
}

/* Actions column specific styles */
.modern-table .actions {
    white-space: nowrap;
    /* Keep buttons on one line */
    text-align: center;
}

/* Buttons in table (Adjust these as needed for size) */
.modern-table .btn-sm {
    /* For Bootstrap's btn-sm */
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 0.25rem;
}

/* Custom button styles */
.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Processing row for spinner */
.processing-row {
    opacity: 0.6;
    /* Dim the row slightly */
    pointer-events: none;
    /* Disable clicks on the row */
}

.processing-row .spinner-border {
    width: 1.2rem;
    height: 1.2rem;
    border-width: 0.2em;
}

/* Modal specific styles for Blazor */
.modal.show.d-block {
    display: block;
    background-color: rgba(0, 0, 0, 0.5);
    /* Dark overlay */
}

.modal-dialog {
    max-width: 500px;
    /* Standard modal width */
}

.modal-content {
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: #343a40;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    /* Align buttons to the right */
}

/* Form control styling within modal */
.modal-body .form-label {
    font-weight: 500;
    color: #495057;
}

.modal-body .form-control {
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    padding: 0.75rem 1rem;
}

.modal-body .validation-message {
    color: #dc3545;
    /* Red for validation errors */
    font-size: 0.875em;
    margin-top: 0.25rem;
    display: block;
    /* Ensures it's on its own line */
}

/* Adjust select box for view mode */
.form-select-modern {
    display: inline-block;
    width: auto;
    /* Adjust width based on content */
    padding: 0.375rem 1.75rem 0.375rem 0.75rem;
    /* Standard select padding */
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    /* Custom arrow icon */
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* === Banner Side === */
.login-banner {
    flex: 1;
    background: url('/api/placeholder/600/600') center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.9), rgba(46, 204, 113, 0.9));
    opacity: 0.85;
}

.banner-content {
    position: relative;
    z-index: 1;
    color: white;
    text-align: center;
    padding: 2rem;
}

.banner-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.banner-text {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* === Form Side === */
.login-form-container {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    margin-bottom: 1.5rem;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color);
}

.logo-accent {
    color: var(--accent-color);
}

.login-title {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--light-text);
}

/* === Form Elements === */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.password-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.forgot-link {
    font-size: 0.9rem;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: #aaa;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
}

/* === Remember Me === */
.remember-me {
    display: flex;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #eee;
    border-radius: 4px;
    transition: var(--transition);
}

.checkbox-container:hover input~.checkmark {
    background-color: #ddd;
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* === Login Button === */
.btn-login {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-login:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Alert === */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.alert i {
    margin-right: 0.5rem;
}

/* === Social Login === */
.social-login {
    margin-top: 1.5rem;
}

.divider {
    text-align: center;
    position: relative;
    margin-bottom: 1.5rem;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background-color: #e1e1e1;
}

.divider span {
    position: relative;
    background-color: white;
    padding: 0 1rem;
    color: var(--light-text);
    font-size: 0.9rem;
}

.social-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid #e1e1e1;
    background-color: white;
}

.social-btn i {
    margin-right: 0.5rem;
}

.google {
    color: var(--google-color);
}

.facebook {
    color: var(--facebook-color);
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* === Register Link === */
.register-link {
    text-align: center;
    margin-top: 2rem;
    color: var(--light-text);
}

/* === Validation === */
.validation-message {
    color: #dc3545 !important;
    /* สีแดงของ Bootstrap (danger) */
    font-size: 0.875rem;
    /* ขนาดฟอนต์ให้เล็กลงเล็กน้อย */
    margin-top: 0.25rem;
    /* เพิ่มระยะห่างด้านบน */
    display: block;
    /* ให้แสดงผลเป็นบล็อก เพื่อให้ขึ้นบรรทัดใหม่ */
}



/* === Buttons === */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--gradient);
    color: white;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(155, 89, 182, 0.3);
}

/* === Admin Table === */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.admin-table th {
    background: var(--gradient);
    color: white;
    font-weight: 600;
}

.admin-table tbody tr:hover {
    background-color: var(--light-bg);
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.action-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-right: 0.5rem;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* === Action Buttons in Table === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0.2rem;
    transition: var(--transition);
    text-decoration: none;
    min-width: 80px;
}

.btn i {
    margin-right: 0.4rem;
    font-size: 0.9rem;
}

/* Approve Button */
.btn-approve {
    background-color: #28a745;
    color: white;
    border: 1px solid #28a745;
}

.btn-approve:hover {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

/* Reject Button */
.btn-reject {
    background-color: #ffc107;
    color: #212529;
    border: 1px solid #ffc107;
}

.btn-reject:hover {
    background-color: #e0a800;
    border-color: #d39e00;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}

/* Delete Button */
.btn-delete {
    background-color: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.btn-delete:hover {
    background-color: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Edit Button */
.btn-edit {
    background-color: #17a2b8;
    color: white;
    border: 1px solid #17a2b8;
}

.btn-edit:hover {
    background-color: #138496;
    border-color: #117a8b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
}

/* View Button */
.btn-view {
    background-color: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

.btn-view:hover {
    background-color: #5a6268;
    border-color: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

/* Button Group in Table */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: flex-start;
    align-items: center;
}

/* Small variant for table buttons */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    min-width: 70px;
}

.btn-sm i {
    margin-right: 0.3rem;
    font-size: 0.8rem;
}

/* Outline variants */
.btn-outline-approve {
    background-color: transparent;
    color: #28a745;
    border: 1px solid #28a745;
}

.btn-outline-approve:hover {
    background-color: #28a745;
    color: white;
}

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

.btn-outline-reject:hover {
    background-color: #ffc107;
    color: #212529;
}

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

.btn-outline-delete:hover {
    background-color: #dc3545;
    color: white;
}

/* Custom styles for Image Preview in Modal */
.existing-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /* Space between image items */
}

.image-preview-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    background-color: #f8f9fa;
}

.image-preview-item img {
    display: block;
    max-width: 100px;
    height: auto;
    border-radius: 2px;
}

.image-preview-item .btn-danger {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(50%, -50%);
    /* Centers the button on the corner */
    width: 24px;
    /* Adjust size */
    height: 24px;
    /* Adjust size */
    border-radius: 50%;
    font-size: 0.8em;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-preview-item .btn-danger i {
    font-size: 0.7em;
    /* Adjust icon size */
}

/* Modal specific styles for Blazor (ensure these exist or add them) */
.modal.show.d-block {
    display: block;
    background-color: rgba(0, 0, 0, 0.5);
    /* Dark overlay */
}

.modal-dialog.modal-lg {
    max-width: 800px;
    /* Make the modal larger for content and images */
}

.modal-content {
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: #343a40;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
}

/* Form control styling within modal */
.modal-body .form-label {
    font-weight: 500;
    color: #495057;
}

.modal-body .form-control {
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    padding: 0.75rem 1rem;
}

.modal-body .validation-message {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 0.25rem;
    display: block;
}

/* สำหรับส่วนข่าวทั้งหมด */
.announcements-section {
    margin-top: 30px;
}

.announcement-list.full-list {
    display: grid;
    gap: 25px;
    /* ระยะห่างระหว่าง card ข่าว */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* ปรับตามขนาดหน้าจอ */
}

.announcement-list.full-list .announcement-item {
    display: flex;
    /* ใช้ flexbox สำหรับการจัดเรียงรูปภาพและเนื้อหา */
    flex-direction: column;
    /* จัดเรียงเป็นคอลัมน์ */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    /* แสดงว่าคลิกได้ */
    background-color: #fff;
    height: 100%;
    /* ทำให้การ์ดสูงเท่ากัน */
}

.announcement-list.full-list .announcement-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.announcement-image-list {
    width: 100%;
    height: 200px;
    /* กำหนดความสูงของรูปภาพ */
    overflow: hidden;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.announcement-image {
    flex-shrink: 0;
    /* Prevents the image from shrinking when content grows */
    width: 200px;
    /* Fixed width for desktop/larger screens */
    height: 150px;
    /* Fixed height for desktop/larger screens */
    overflow: hidden;
    /* Hides parts of the image if it exceeds container */
}

.announcement-image img {
    width: 100%;
    /* Important: Image will take 100% of its parent's width */
    height: 100%;
    /* Important: Image will take 100% of its parent's height */
    object-fit: cover;
    /* Ensures the image covers the area without distortion, cropping if necessary */
    display: block;
    /* Removes extra space below the image */
}

.announcement-content {
    flex-grow: 1;
    /* Allows content to take up remaining space */
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.announcement-title {
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 5px;
    color: #333;
}

.announcement-date {
    font-size: 0.85em;
    color: #777;
    margin-bottom: 10px;
}

.announcement-excerpt {
    font-size: 0.95em;
    color: #555;
    line-height: 1.5;
}


.announcement-image-list img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* ครอบคลุมพื้นที่โดยไม่บิดเบี้ยว */
    display: block;
}

.announcement-content-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* ทำให้เนื้อหาขยายเต็มที่ */
}

.announcement-content-list .announcement-title {
    font-size: 1.4em;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.3;
}

.announcement-content-list .announcement-date {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 15px;
}

.announcement-content-list .announcement-excerpt {
    font-size: 1em;
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
    /* ทำให้ข้อความส่วนขยายเต็มพื้นที่ */
}

.announcement-content-list .btn {
    align-self: flex-start;
    /* จัดปุ่มไปทางซ้าย */
}


/* สำหรับหน้า Detail */
.announcement-content-detail {
    font-size: 1.1em;
    line-height: 1.8;
    color: #444;
}

.announcement-content-detail img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

/* Add or ensure your modern-table responsive CSS is in place */
/* Example: */
@media (max-width: 768px) {
    .modern-table thead {
        display: none;
    }

    .modern-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border: none;
    }

    .modern-table tbody td {
        display: block;
        padding: 0.8rem 1rem;
        border-bottom: 1px solid #f1f3f4;
        position: relative;
        padding-left: 45%;
        /* Adjust as needed */
    }

    .modern-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #4a5568;
    }

    .modern-table tbody td:last-child {
        border-bottom: none;
        text-align: center;
        padding-left: 1rem;
    }

    .modern-table tbody td:last-child:before {
        display: none;
    }

    .announcement-item {
        flex-direction: column;
        /* Stack image and content vertically on small screens */
    }

    .announcement-image {
        width: 100%;
        /* Image takes full width on small screens */
        height: 200px;
        /* Adjust height as needed for mobile display */
    }

    .announcement-image img {
        /* These properties are already set above, but good to re-iterate for clarity */
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .announcement-content {
        padding: 10px;
        /* Adjust padding for mobile */
    }

    .announcement-title {
        font-size: 1.1em;
        /* Adjust font size for mobile */
    }
}

/* === Responsive Design for Global Elements === */
@media (max-width: 992px) {

    /* ... โค้ดเดิมของ .hero-title, .hero-text, .page-title, .main-content ... */
    .grid-cards {
        /* บนหน้าจอ Tablet (น้อยกว่า 992px) ให้แสดง 2 คอลัมน์ และ min-width ลดลง */
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
        /* ลด gap เล็กน้อย */
    }

    .card {
        padding: 2rem;
        /* ลด padding ของ Card ใหญ่บน Tablet */
    }

    .card-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 2rem;
        /* ลด padding ของ stat-card บน Tablet */
    }

    .stat-number {
        font-size: 3rem;
    }

    .stat-label {
        font-size: 1.15rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-text {
        font-size: 1rem;
    }

    /* ... */
    .main-content {
        padding: 1rem;
        /* ลด padding ของเนื้อหาหลักเมื่อหน้าจอเล็ก */
    }

    .announcement-list.full-list {
        grid-template-columns: 1fr;
        /* เปลี่ยนเป็น 1 คอลัมน์บนมือถือ */
    }

    .announcement-item {
        flex-direction: column;
        /* Stack image and content vertically on small screens */
    }

    .announcement-image {
        width: 100%;
        /* Image takes full width on small screens */
        height: 200px;
        /* Adjust height as needed for mobile display */
    }

    .announcement-image img {
        /* These properties are already set above, but good to re-iterate for clarity */
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .announcement-content {
        padding: 10px;
        /* Adjust padding for mobile */
    }

    .announcement-title {
        font-size: 1.1em;
        /* Adjust font size for mobile */
    }

    /* ... โค้ด feature-box เดิม ... */
}

/* select */
.form-group {
    margin-bottom: 2rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

/* === Style 1: Modern Gradient Select === */
.form-select-modern {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b59b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.form-select-modern:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
    background-color: rgba(232, 218, 239, 0.1);
}

.form-select-modern:hover {
    border-color: var(--primary-light);
    background-color: rgba(232, 218, 239, 0.05);
}

/* === Style 2: Floating Label Select === */
.form-floating {
    position: relative;
}

.form-select-floating {
    width: 100%;
    padding: 1.2rem 3rem 0.4rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b59b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.form-floating .form-label-floating {
    position: absolute;
    top: 0.4rem;
    left: 1rem;
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
    pointer-events: none;
    transition: var(--transition);
}

.form-select-floating:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.form-select-floating:focus+.form-label-floating {
    color: var(--primary-dark);
}

/* === Style 3: Gradient Border Select === */
.form-select-gradient-wrapper {
    position: relative;
    background: var(--gradient);
    border-radius: 14px;
    padding: 2px;
}

.form-select-gradient {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: var(--white);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b59b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.form-select-gradient:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.2);
}

.form-select-gradient-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.2);
}

/* === Style 4: Rounded Pill Select === */
.form-select-pill {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b59b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1.5rem center;
    background-size: 1.2rem;
}

.form-select-pill:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
    background: rgba(232, 218, 239, 0.1);
}

.form-select-pill:hover {
    border-color: var(--primary-light);
    transform: scale(1.02);
}

/* === Style 5: Neumorphism Select === */
.form-select-neumorphism {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: var(--light-bg);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow:
        8px 8px 16px rgba(155, 89, 182, 0.1),
        -8px -8px 16px rgba(255, 255, 255, 0.8);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b59b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.form-select-neumorphism:focus {
    outline: none;
    box-shadow:
        inset 4px 4px 8px rgba(155, 89, 182, 0.1),
        inset -4px -4px 8px rgba(255, 255, 255, 0.8);
}

.form-select-neumorphism:hover {
    box-shadow:
        6px 6px 12px rgba(155, 89, 182, 0.15),
        -6px -6px 12px rgba(255, 255, 255, 0.9);
}

/* === Style 6: Icon Select === */
.form-select-icon-wrapper {
    position: relative;
}

.form-select-icon {
    width: 100%;
    padding: 1rem 3rem 1rem 3.5rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b59b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.form-select-icon-wrapper .select-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.2rem;
    pointer-events: none;
}

.form-select-icon:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.form-select-icon:focus+.select-icon {
    color: var(--primary-dark);
}

/* === Multiple Select Styling === */
.form-select-multiple {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.form-select-multiple:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.form-select-multiple option {
    padding: 0.5rem;
    border-radius: 6px;
    margin: 0.2rem 0;
}

.form-select-multiple option:checked {
    background: var(--gradient);
    color: white;
}

/* === Small Size Variant === */
.form-select-sm {
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    background-size: 1rem;
    background-position: right 0.75rem center;
}

/* === Large Size Variant === */
.form-select-lg {
    padding: 1.25rem 3.5rem 1.25rem 1.25rem;
    font-size: 1.125rem;
    background-size: 1.4rem;
    background-position: right 1.25rem center;
}

/* === Disabled State === */
.form-select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* === Error State === */
.form-select.is-invalid {
    border-color: #dc3545;
}

.form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* === Success State === */
.form-select.is-valid {
    border-color: #28a745;
}

.form-select.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.demo-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background: rgba(232, 218, 239, 0.1);
    border-radius: 15px;
}

.demo-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.demo-description {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* BlazorApp.Client/wwwroot/css/app.css หรือไฟล์ใหม่ */

.chat-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-bubble {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-mine {
    background-color: #e2f7cb;
    /* สีเขียวอ่อน */
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.chat-other {
    background-color: #f1f0f0;
    /* สีเทาอ่อน */
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

.chat-header {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.chat-header strong {
    color: #333;
    font-weight: bold;
}

.chat-timestamp {
    float: right;
    font-size: 0.75em;
    color: #999;
}

.chat-body p {
    margin: 0;
    padding: 0;
    line-height: 1.4;
    color: #333;
}

.chat-link {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    color: #007bff;
    text-decoration: none;
}

.chat-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {

    /* เพิ่ม breakpoint นี้เพื่อเปลี่ยนจาก 2 คอลัมน์เป็น 1 คอลัมน์บน Mobile */
    .grid-cards {
        grid-template-columns: 1fr;
        /* ให้ card แสดง 1 คอลัมน์เต็มเมื่อหน้าจอ Mobile */
        gap: 1.5rem;
    }

    .card {
        padding: 1.5rem;
        /* ลด padding ของ card เมื่อหน้าจอเล็กมาก */
    }

    .card-title {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    .stat-card {
        padding: 1.8rem;
        /* ลด padding ของ stat-card บน Mobile */
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .stat-label {
        font-size: 1rem;
    }

    /* ... โค้ด hero-section, card, feature-box เดิมสำหรับ 576px ... */
    .login-wrapper {
        flex-direction: column;
        height: auto;
    }

    .login-banner {
        display: none;
    }

    .login-form-container {
        padding: 2rem;
    }

    .modern-table {
        border-radius: 0;
        /* Remove overall table border-radius on small screens */
        box-shadow: none;
        /* Remove overall table shadow */
    }

    .modern-table thead {
        display: none;
        /* Hide table headers */
    }

    .modern-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border: none;
        background-color: #fff;
        /* Ensure row background is white */
        padding: 0.5rem;
        /* Add some internal padding to the row-card */
    }

    .modern-table tbody td {
        display: block;
        padding: 0.8rem 1rem;
        border-bottom: 1px solid #f1f3f4;
        position: relative;
        padding-left: 45%;
        /* Space for data-label */
        text-align: left;
        /* Ensure text aligns left */
    }

    .modern-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #4a5568;
    }

    .modern-table tbody td:last-child {
        border-bottom: none;
        text-align: center;
        padding-left: 1rem;
        /* Reset padding for action buttons */
    }

    .modern-table tbody td:last-child:before {
        display: none;
        /* Hide data-label for action buttons */
    }

    /* Adjust button sizes for mobile if needed (optional) */
    .modern-table .btn {
        padding: 0.5rem 1rem;
        /* Make buttons slightly larger on mobile */
        font-size: 0.95rem;
    }

    .announcement-list.full-list {
        grid-template-columns: 1fr;
        /* เปลี่ยนเป็น 1 คอลัมน์บนมือถือ */
    }
}

@media (max-width: 576px) {

    /* โค้ดเดิมของคุณสำหรับ 576px */
    .hero-section {
        padding: 2rem;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .announcement-list.full-list {
        grid-template-columns: 1fr;
        /* เปลี่ยนเป็น 1 คอลัมน์บนมือถือ */
    }

    /* .card และ stat-card ได้ถูกปรับใน 768px แล้ว อาจไม่จำเป็นต้องปรับซ้ำ */
}