/* ดึงฟอนต์ Prompt จาก Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

/* กำหนดฟอนต์หลักให้กับทั้งเว็บไซต์ */
body {
    font-family: 'Prompt', sans-serif;
    background-color: #f8f9fa;
    color: #333333;
}

/* ==========================================
   1. แถบเมนูด้านบน (Navbar)
   ========================================== */
.navbar-brand {
    font-size: 1.4rem;
    letter-spacing: 0.5px;
}

#reportNavContainer .nav-link {
    color: #ffe3e3;
    font-weight: 600;
}

#reportNavContainer .nav-link:hover {
    color: #ffffff;
}

/* ==========================================
   2. ตกแต่งการ์ดของแจก (Item Card)
   ========================================== */
.item-card {
    border: none;
    border-radius: 16px;
    border: 1px solid #e8eee9;
    box-shadow: 0 8px 22px rgba(25, 80, 49, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    background-color: #ffffff;
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: 260px;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* เอฟเฟกต์เวลาเมาส์ชี้การ์ดให้ลอยขึ้น */
.item-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 30px rgba(25, 80, 49, 0.16);
}

.item-card .card-img-top {
    border-bottom: 1px solid #edf2ee;
}

.item-card .card-body {
    padding: 1.15rem;
}

.item-card .card-title {
    color: #183b29;
    letter-spacing: 0;
}

.item-card .text-success {
    color: #16834c !important;
}

.item-card .badge {
    border-radius: 7px;
    font-weight: 600;
}

.item-card .bg-secondary {
    background-color: #eef5f0 !important;
    color: #286443 !important;
    border: 1px solid #cfe3d4;
}

.item-owner-controls {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.35rem !important;
}

.item-owner-controls .btn {
    min-height: 32px;
    padding: 0.3rem 0.4rem !important;
    border-radius: 9px !important;
    font-size: 0.78rem !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.item-owner-controls .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(25, 80, 49, 0.14);
}

.item-card .request-btn {
    border-radius: 10px !important;
    border-width: 1.5px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.item-card .request-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(25, 135, 84, 0.18);
}

@media (max-width: 420px) {
    .item-owner-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 📱 ปรับการ์ดสินค้าสำหรับหน้าจอมือถือ (2 คอลัมน์) */
.item-card-img {
    height: 140px;
    object-fit: cover;
    width: 100%;
    aspect-ratio: 16 / 10;
    content-visibility: auto;
}

@media (min-width: 768px) {
    .item-card-img {
        height: 200px;
    }
}

@media (max-width: 576px) {
    .item-card .card-body {
        padding: 0.65rem !important;
    }
    .item-card .badge {
        font-size: 0.68rem !important;
        padding: 0.2rem 0.45rem !important;
    }
    .item-card .card-title {
        font-size: 0.95rem !important;
    }
    .item-card .request-btn {
        font-size: 0.8rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    .item-owner-controls {
        margin-top: 0.5rem !important;
        padding-top: 0.5rem !important;
        gap: 0.25rem !important;
    }
    .item-owner-controls .btn {
        font-size: 0.75rem !important;
        padding: 0.2rem 0.35rem !important;
    }

    /* 📱 ย่อขนาดหัวข้อรายการของแจกล่าสุดบนมือถือ */
    .feed-title {
        font-size: 1.15rem !important;
        letter-spacing: -0.2px;
    }
    .feed-see-all {
        font-size: 0.85rem !important;
        white-space: nowrap;
    }
    .feed-header {
        margin-bottom: 0.65rem !important;
    }

    /* 📱 ย่อขนาดกล่องตัวกรองข้อมูลบนมือถือ */
    #filterForm {
        padding: 0.6rem 0.75rem !important;
        border-radius: 16px !important;
        gap: 0.35rem !important;
        margin-bottom: 0.85rem !important;
    }
    #filterForm .form-select,
    #filterForm .form-control,
    #filterForm .input-group-text,
    #filterForm .btn {
        font-size: 0.82rem !important;
        padding-top: 0.3rem !important;
        padding-bottom: 0.3rem !important;
        height: 36px !important;
    }
    #filterForm .form-select {
        padding-left: 0.65rem !important;
        padding-right: 1.5rem !important;
        background-position: right 0.5rem center !important;
    }
    #filterForm .filter-col-half {
        width: calc(50% - 0.2rem) !important;
        flex: 1 1 calc(50% - 0.2rem) !important;
        min-width: 0 !important;
    }
    #filterForm .filter-col-full {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
    #filterForm .filter-btn-group {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 0.2rem !important;
        gap: 0.35rem !important;
    }
    #filterForm .filter-btn-group .btn {
        flex: 1 !important;
        padding: 0.35rem 0.5rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* กรอบตัวกรองข้อมูล (Filter Form) ดีไซน์ Modern Card สะอาดตาและจัดเรียงแถวเดียวสวยงาม */
#filterForm {
    border-radius: 20px !important;
    border: 1px solid #edf2f7 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
    background: #ffffff !important;
    transition: all 0.2s ease;
}
#filterForm .form-select,
#filterForm .input-group,
#filterForm .form-control {
    background-color: #f8fafc !important;
    border: 1px solid #f1f5f9 !important;
    color: #334155 !important;
    font-weight: 500 !important;
    transition: all 0.2s ease;
}
#filterForm .form-select:hover,
#filterForm .input-group:hover {
    border-color: #cbd5e1 !important;
    background-color: #f1f5f9 !important;
}
#filterForm .form-select:focus,
#filterForm .form-control:focus {
    border-color: #198754 !important;
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.12) !important;
}
.my-status-pill {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
}
.my-status-pill:hover {
    transform: translateY(-1px);
}

/* ป้ายหมวดหมู่มุมบนขวาของการ์ด */
.item-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

/* ==========================================
   3. แถบค้นหาและหมวดหมู่ Custom (ตามรูปภาพ)
   ========================================== */
.search-box-custom {
    transition: all 0.25s ease-in-out;
    border-color: #e2e8f0 !important;
}

/* เอฟเฟกต์เมื่อคลิกพิมพ์ในช่องค้นหา */
.search-box-custom:focus-within {
    border-color: #198754 !important; /* เปลี่ยนเส้นขอบเป็นสีเขียว */
    box-shadow: 0 4px 16px rgba(25, 135, 84, 0.15) !important;
}

/* ตกแต่งเมนู Dropdown หมวดหมู่ */
.dropdown-menu {
    border-radius: 12px;
    padding: 8px;
}

.dropdown-item {
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #e8f5e9;
    color: #198754;
}

.dropdown-item.active, 
.dropdown-item:active {
    background-color: #198754;
    color: #ffffff;
}

/* ==========================================
   4. หน้าต่างป๊อปอัป (Modal)
   ========================================== */
.modal-content {
    border-radius: 20px;
}
/* ==========================================
   5. สไตล์ Hero Section รูปภาพพื้นหลังเต็มเว็บ
   ========================================== */
.hero-section {
    min-height: 520px; /* ความสูงของแบนเนอร์ */
    /* ใส่รูปภาพพื้นหลังตามที่คุณต้องการ */
    background-image: url('https://images.unsplash.com/photo-1542838132-92c53300491e?w=1600&auto=format&fit=crop&q=80');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ชั้น Overlay สีเข้มทับบนรูป เพื่อดันให้ตัวอักษรสีขาวเด่นขึ้นมา */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.45) 60%, rgba(0, 0, 0, 0.2) 100%);
    z-index: 1;
}

/* เพิ่มเงาบางๆ ให้ตัวอักษรให้อ่านง่ายยิ่งขึ้น */
.text-shadow {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.profile-modal {
    overflow: hidden;
    border: 1px solid #dce9df;
    box-shadow: 0 18px 45px rgba(20, 64, 39, 0.2);
}

.profile-modal .modal-header {
    background: linear-gradient(135deg, #eaf7ee, #ffffff);
    border-bottom: 1px solid #dce9df;
}

.profile-modal .modal-title,
.profile-form-heading,
.profile-list-heading {
    color: #17643b;
    font-weight: 700;
}

.profile-form,
.profile-items-list {
    border: 1px solid #e1eee4;
    border-radius: 14px;
    padding: 1rem;
    background-color: #fbfefc;
}

.profile-form-heading,
.profile-list-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.profile-item-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e8f0ea;
}

.profile-item-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.profile-item-row:first-child {
    padding-top: 0;
}

.profile-item-row img {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #d7e6da;
}

.min-width-0 {
    min-width: 0;
}

.report-modal {
    overflow: hidden;
    border: 1px solid #f0d6d6;
    box-shadow: 0 18px 45px rgba(110, 35, 35, 0.18);
}

.report-modal .modal-header {
    background: #fff5f5;
    border-bottom: 1px solid #f0d6d6;
}

.report-modal .modal-title {
    color: #a52828;
    font-weight: 700;
}

.admin-page {
    min-height: 100vh;
    background: radial-gradient(circle at 10% 0%, rgba(210, 239, 220, 0.55), transparent 32%), #f4f8f5;
}

.admin-page .navbar {
    background: linear-gradient(100deg, #075b35, #168653) !important;
    min-height: 66px;
}

.admin-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    color: #0b6a3b;
    background: #dff5e6;
}

.admin-brand-label {
    padding: 0.18rem 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 5px;
    color: #d9f4e2;
    font-size: 0.62rem;
    letter-spacing: 1px;
}

.admin-live-status {
    color: #d9f4e2;
    font-size: 0.78rem;
}

.admin-live-status span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 0.35rem;
    border-radius: 50%;
    background: #8df0af;
    box-shadow: 0 0 0 4px rgba(141, 240, 175, 0.14);
}

.admin-user-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.65rem 0.25rem 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    color: #183b29;
    background: #ffffff;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.admin-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #17643b;
    background: #ffffff;
}

.admin-user-chip strong,
.admin-user-chip small {
    display: block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-chip strong {
    font-size: 0.78rem;
    color: #183b29;
}

.admin-user-chip small {
    color: #668070;
    font-size: 0.65rem;
}

.admin-account-menu {
    min-width: 260px;
    padding: 0.45rem;
    border: 1px solid #dce9df !important;
}

.admin-account-heading {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem;
}

.admin-account-heading strong,
.admin-account-heading small {
    display: block;
    color: #183b29;
}

.admin-account-heading strong {
    font-size: 0.9rem;
}

.admin-account-heading small {
    max-width: 190px;
    overflow: hidden;
    color: #668070;
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-account-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #ffffff;
    background: #198754;
}

.admin-account-role {
    margin: 0.15rem 0.45rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    color: #17643b;
    background: #eff9f1;
    font-size: 0.78rem;
    font-weight: 600;
}

.admin-account-role i {
    margin-right: 0.25rem;
}

.admin-user-chevron {
    margin-left: 0.2rem;
    color: #527060;
    font-size: 0.7rem;
}

.admin-page-heading {
    min-height: 92px;
}

.admin-eyebrow {
    margin-bottom: 0.4rem;
    color: #198754;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.admin-eyebrow span {
    display: inline-block;
    width: 28px;
    height: 2px;
    margin-left: 0.35rem;
    vertical-align: middle;
    background: #9bd3ad;
}

.admin-date-label {
    padding: 0.55rem 0.75rem;
    border: 1px solid #dce9df;
    border-radius: 9px;
    color: #53705d;
    background: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.admin-filter {
    max-width: 190px;
}

.admin-stat,
.admin-panel {
    background: #ffffff;
    border: 1px solid #dce9df;
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(25, 80, 49, 0.07);
}

.admin-stat {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    width: 100%;
    border: 0;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    min-height: 104px;
}

.admin-summary-card:hover {
    background: #f1faf3;
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(25, 80, 49, 0.13);
}

.admin-stat i {
    color: #198754;
    font-size: 1.6rem;
}

.admin-stat:nth-child(1) .admin-stat i { color: #2674c9; }
.admin-stat:nth-child(2) .admin-stat i { color: #c27a19; }
.admin-stat:nth-child(3) .admin-stat i { color: #d05a4e; }
.admin-stat:nth-child(4) .admin-stat i { color: #198754; }

.admin-stat strong {
    color: #183b29;
    font-size: 1.45rem;
}

.admin-panel {
    padding: 1.25rem;
    min-height: 210px;
}

.admin-tabs {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.admin-tab {
    border: 1px solid #cfe3d4;
    border-radius: 9px;
    padding: 0.55rem 0.9rem;
    background: #ffffff;
    color: #286443;
    font-weight: 600;
}

.admin-tab.active,
.admin-tab:hover {
    background: #198754;
    border-color: #198754;
    color: #ffffff;
}

.admin-table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.admin-table thead th {
    background: #f1faf3;
    color: #286443;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background: #fbfefc;
}

.admin-report-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid #edf2ee;
}

.admin-report-main {
    min-width: 0;
}

.admin-report-actions {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 0.45rem;
    flex-shrink: 0;
}

@media (max-width: 576px) {
    .admin-page .navbar .container {
        gap: 0.5rem;
    }

    .admin-live-status {
        display: none;
    }

    .admin-user-chip {
        display: none;
    }

    .admin-page-heading {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 0.75rem;
    }

    .admin-filter {
        max-width: 150px;
    }

    .admin-report-row {
        flex-direction: column;
    }

    .admin-report-actions {
        align-items: flex-start;
    }
}

.chat-inbox-modal {
    overflow: hidden;
    border: 1px solid #dce9df;
    box-shadow: 0 18px 45px rgba(20, 64, 39, 0.2);
}

.chat-inbox-dialog {
    max-width: 760px;
    width: calc(100% - 2rem);
}

.chat-inbox-modal .modal-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #eaf7ee, #ffffff);
    border-bottom: 1px solid #dce9df;
}

.chat-inbox-modal .modal-title {
    color: #17643b;
    font-weight: 700;
}

.chat-room-btn {
    padding: 1rem 1.25rem;
    border: 0;
    border-bottom: 1px solid #edf2ee;
    color: #24422f;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.chat-room-btn:hover,
.chat-room-btn:focus {
    color: #24422f;
    background-color: #f1faf3;
}

.chat-room-content {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.chat-item-thumb {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #d7e6da;
    background: #eef5f0;
}

.chat-room-details {
    min-width: 0;
    flex: 1;
}

.chat-item-title {
    color: #183b29;
}

.chat-latest-message {
    margin-top: 0.15rem;
    color: #52635a;
}

@media (max-width: 420px) {
    .chat-inbox-dialog {
        width: calc(100% - 1rem);
    }

    .chat-item-thumb {
        width: 60px;
        height: 60px;
        flex-basis: 60px;
    }
}
/* Make all navbar links white */
.navbar-dark .navbar-nav .nav-link {
    color: #ffffff !important;
    font-weight: 500;
}
.navbar-dark .navbar-nav .nav-link:hover {
    color: #e0e0e0 !important;
}

/* ==========================================
   🔑 Flatpickr Inline Calendar (Full Width & Responsive)
   ========================================== */
#rentalBookingModal {
    width: 100% !important;
}

#rentalBookingModal .flatpickr-calendar {
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

#rentalBookingModal .flatpickr-innerContainer {
    width: 100% !important;
    display: block !important;
}

#rentalBookingModal .flatpickr-rContainer {
    width: 100% !important;
    max-width: 100% !important;
}

#rentalBookingModal .flatpickr-days {
    width: 100% !important;
}

#rentalBookingModal .dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
}

#rentalBookingModal .flatpickr-day {
    max-width: 14.2857% !important;
    flex-basis: 14.2857% !important;
    height: 46px !important;
    line-height: 46px !important;
    border-radius: 10px !important;
    font-size: 1.05rem !important;
    font-weight: 500 !important;
    margin: 2px 0 !important;
}

#rentalBookingModal .flatpickr-weekdays {
    width: 100% !important;
    height: 38px !important;
}

#rentalBookingModal .flatpickr-weekdaycontainer {
    width: 100% !important;
    display: flex !important;
}

#rentalBookingModal span.flatpickr-weekday {
    flex: 1 !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: #495057 !important;
}

#rentalBookingModal .flatpickr-months {
    padding: 6px 0 !important;
    margin-bottom: 6px !important;
}

#rentalBookingModal .flatpickr-current-month {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    padding-top: 4px !important;
}

#rentalBookingModal .flatpickr-day.selected, 
#rentalBookingModal .flatpickr-day.startRange, 
#rentalBookingModal .flatpickr-day.endRange {
    background: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

#rentalBookingModal .flatpickr-day.inRange {
    background: #e7f1ff !important;
    box-shadow: -5px 0 0 #e7f1ff, 5px 0 0 #e7f1ff !important;
    border-color: #e7f1ff !important;
    color: #0d6efd !important;
}
