/* ========================================= */
/* DEER THEME - GLOBAL STYLES ONLY */
/* ========================================= */

/* ========================================= */
/* CSS VARIABLES - COLOR SYSTEM */
/* ========================================= */

:root {
    /* Main Colors */
    --primary: #8B4513;
    --secondary: #228B22;
    --success: #52a067;
    --info: #7fb3d3;
    --warning: #f5d547;
    --danger: #e74c3c;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --white: #ffffff;

    /* Deer Theme Colors */
    --deer-brown: #8B4513;
    --deer-light-brown: #CD853F;
    --deer-cream: #F5DEB3;
    --earth-brown: #6B4423;
    --soft-cream: #FDF6E3;
    --warm-white: #FEFEFE;

    /* Nature Colors */
    --forest-green: #228B22;
    --sage-green: #9CAF88;
    --mint-green: #98FB98;
    --nature-dark: #2F4F2F;
}

/* ========================================= */
/* GLOBAL BASE STYLES */
/* ========================================= */

/* Thai Font Support */
body {
    font-family: 'Kanit', sans-serif;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
}

/* ========================================= */
/* BOOTSTRAP OVERRIDES */
/* ========================================= */

.bg-primary,
.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover {
    background-color: var(--earth-brown) !important;
    border-color: var(--earth-brown) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.bg-light {
    background-color: var(--soft-cream) !important;
}

/* ========================================= */
/* NAVIGATION COMPONENTS */
/* ========================================= */

.navbar {
    background: transparent !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    padding: 15px 0;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(139, 69, 19, 0.9) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.navbar-brand h1 {
    color: var(--white) !important;
    font-size: 1.8rem;
    margin: 0;
}

.navbar-brand h1 span {
    color: var(--warning) !important;
}

/* เพิ่มส่วนนี้เพื่อดันเมนูไปขวา */
.navbar-collapse {
    justify-content: flex-end !important;
}

.navbar-collapse .navbar-nav {
    margin-right: -50px !important;
    /* ปรับค่าตามต้องการ */
    padding-right: 0 !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 8px 20px !important;
    margin: 0 1px;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--warning) !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.navbar-nav .nav-link.active {
    color: var(--warning) !important;
    background: rgba(245, 213, 71, 0.2);
    box-shadow: 0 0 20px rgba(245, 213, 71, 0.3);
}

/* Mobile Navigation */
@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(139, 69, 19, 0.95);
        border-radius: 15px;
        margin-top: 15px;
        padding: 20px;
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        justify-content: center !important;
        /* กลางในมือถือ */
    }

    .navbar-collapse .navbar-nav {
        margin-right: 0 !important;
        /* รีเซ็ตในมือถือ */
    }

    .navbar-nav .nav-link {
        text-align: center;
        margin: 5px 0;
        padding: 12px 20px !important;
    }
}

/* ========================================= */
/* NAVIGATION DROPDOWN STYLES */
/* ========================================= */

/* Dropdown Menu Base */
.navbar .dropdown-menu {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: none;
    box-shadow: 0 15px 35px rgba(139, 69, 19, 0.15);
    border-radius: 15px;
    margin-top: 10px;
    min-width: 300px;
    padding: 15px;
    border: 1px solid rgba(139, 69, 19, 0.1);
    /* เพิ่มส่วนนี้เพื่อให้ dropdown ไม่เลื่อนตำแหน่งของ navbar */
    right: 0 !important;
    /* ให้ dropdown ชิดขวา */
    left: auto !important;
    /* ยกเลิก left positioning */
}

/* Dropdown Items */
.navbar .dropdown-item {
    padding: 12px 15px;
    transition: all 0.3s ease;
    border-radius: 10px;
    margin: 3px 0;
    font-weight: 500;
    color: var(--dark);
    display: flex;
    align-items: center;
}

.navbar .dropdown-item:hover {
    background: linear-gradient(135deg, var(--soft-cream) 0%, var(--deer-cream) 100%);
    color: var(--primary);
    transform: translateX(8px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.1);
}

.navbar .dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
}

.navbar .dropdown-item small {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-top: 2px;
}

/* Dropdown Headers */
.navbar .dropdown-header {
    color: var(--primary);
    font-weight: 700;
    padding: 15px 15px 10px;
    border-bottom: 2px solid var(--deer-cream);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

/* Dropdown Divider */
.navbar .dropdown-divider {
    border-color: var(--deer-cream);
    margin: 10px 0;
    opacity: 0.7;
}

/* Dropdown Toggle Arrow */
.navbar .dropdown-toggle::after {
    border: none;
    content: "\f107";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    vertical-align: middle;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.navbar .dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* Special Dropdown Items (Download, View All) */
.navbar .dropdown-item.text-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--earth-brown) 100%);
    color: var(--white) !important;
    font-weight: 600;
    margin-top: 8px;
}

.navbar .dropdown-item.text-primary:hover {
    background: linear-gradient(135deg, var(--earth-brown) 0%, var(--primary) 100%);
    transform: translateX(10px) scale(1.02);
    box-shadow: 0 8px 20px rgba(139, 69, 19, 0.3);
}

/* เพิ่มส่วนนี้เพื่อควบคุมตำแหน่ง dropdown แต่ละอัน */
.navbar .nav-item.dropdown:last-child .dropdown-menu,
.navbar .nav-item.dropdown:nth-last-child(2) .dropdown-menu {
    right: 0 !important;
    left: auto !important;
}

/* Mobile Dropdown Styles */
@media (max-width: 991px) {
    .navbar .dropdown-menu {
        background: rgba(139, 69, 19, 0.95);
        backdrop-filter: blur(15px);
        margin-top: 8px;
        border-radius: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        min-width: 100%;
        right: auto !important;
        /* รีเซ็ตในมือถือ */
        left: 0 !important;
    }

    .navbar .dropdown-item {
        color: rgba(255, 255, 255, 0.9);
        padding: 15px 20px;
    }

    .navbar .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--warning);
        transform: translateX(5px);
    }

    .navbar .dropdown-header {
        color: var(--warning);
        border-bottom-color: rgba(245, 213, 71, 0.3);
    }

    .navbar .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.1);
    }

    .navbar .dropdown-item.text-primary {
        background: linear-gradient(135deg, var(--warning) 0%, #f39c12 100%);
        color: var(--dark) !important;
    }

    .navbar .dropdown-item.text-primary:hover {
        background: linear-gradient(135deg, #f39c12 0%, var(--warning) 100%);
        transform: translateX(8px) scale(1.02);
    }
}

/* Animation for dropdown show */
.navbar .dropdown-menu.show {
    animation: dropdownFadeIn 0.3s ease-out;
}

@keyframes dropdownFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================= */
/* FOOTER COMPONENTS */
/* ========================================= */

.footer {
    background: linear-gradient(135deg, var(--nature-dark) 0%, var(--primary) 50%, var(--earth-brown) 100%) !important;
    position: relative;
    overflow: hidden;
}

/* Background pattern with subtle gradients */
.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        url('../img/footer-bg.png') right no-repeat;
    /* รูปใหม่ที่อยากเพิ่ม */
    background-size: contain;
    opacity: 0.5;
    /* จางๆ */
    z-index: 1;
}

/* ให้เนื้อหา footer อยู่บน pattern */
.footer .container {
    position: relative;
    z-index: 2;
}

/* Brand Styling */
.footer .deer-logo {
    transition: all 0.3s ease;
}

.footer .deer-logo:hover {
    transform: scale(1.1) rotate(10deg);
}

.footer h2 {
    font-family: 'Kanit', sans-serif !important;
    font-weight: 700;
}

.footer p {
    font-family: 'Kanit', sans-serif !important;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
}

/* Social Buttons */
.btn-social {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(245, 213, 71, 0.3);
    color: var(--warning);
    border-radius: 50%;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-social:hover {
    background: var(--warning);
    color: var(--dark);
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(245, 213, 71, 0.4);
    border-color: var(--warning);
}

.btn-social i {
    font-size: 1.3rem;
}

/* Footer Links */
.footer-links {
    display: flex;
    flex-direction: column;
}

.footer-link {
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none;
    padding: 10px 0;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    padding-left: 0;
    font-family: 'Kanit', sans-serif !important;
    position: relative;
    font-weight: 500;
}

.footer-link:hover {
    color: var(--warning) !important;
    padding-left: 20px;
    border-left-color: var(--warning);
}

.footer-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background: var(--warning);
    transition: width 0.3s ease;
}

.footer-link:hover::before {
    width: 15px;
}

/* Farm Links */
.farm-link {
    display: flex;
    flex-direction: column;
    margin-bottom: 5px;
}

.farm-link strong {
    font-family: 'Kanit', sans-serif !important;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 3px;
}

.farm-link small {
    font-family: 'Kanit', sans-serif !important;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    font-weight: 300;
}

/* Contact Info */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.contact-item i {
    font-size: 1.3rem;
    margin-top: 3px;
    width: 25px;
    text-align: center;
}

.contact-item div {
    flex: 1;
}

.contact-item strong {
    display: block;
    font-family: 'Kanit', sans-serif !important;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 3px;
}

.contact-item span {
    font-family: 'Kanit', sans-serif !important;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Download Buttons */
.download-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-download {
    background: rgba(245, 213, 71, 0.2);
    border: 1px solid var(--warning);
    color: var(--warning);
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif !important;
}

.btn-download:hover {
    background: var(--warning);
    color: var(--dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 213, 71, 0.3);
}

.btn-download i {
    margin-right: 8px;
}

/* Footer Bottom */
.footer-bottom {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 25px 0;
    margin-top: 40px;
}

.footer-bottom .copyright p {
    font-family: 'Kanit', sans-serif !important;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: 400;
}

.footer-bottom .copyright a {
    color: var(--warning);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
}

.footer-bottom .copyright a:hover {
    color: var(--white);
    text-shadow: 0 0 10px rgba(245, 213, 71, 0.5);
}

.footer-bottom small {
    font-family: 'Kanit', sans-serif !important;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
}

.footer-bottom small a {
    color: var(--warning);
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-bottom small a:hover {
    text-decoration: underline;
}

/* Footer Menu */
.footer-menu a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-family: 'Kanit', sans-serif !important;
    transition: all 0.3s ease;
    font-weight: 400;
    margin: 0 10px;
}

.footer-menu a:hover {
    color: var(--warning);
}

/* Section Headers */
.footer h5 {
    font-family: 'Kanit', sans-serif !important;
    font-weight: 600;
    position: relative;
    padding-bottom: 12px;
    margin-bottom: 25px;
}

.footer h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--warning);
    border-radius: 2px;
}

.footer h6 {
    font-family: 'Kanit', sans-serif !important;
    font-weight: 600;
    color: var(--warning);
}

/* Footer Social Section */
.footer-social h6 {
    font-size: 1rem;
    margin-bottom: 15px;
}

.footer-social .d-flex {
    gap: 10px;
}

/* Responsive Design for Footer */
@media (max-width: 991px) {
    .footer-social {
        text-align: center;
        margin-top: 20px;
    }

    .contact-info {
        margin-top: 20px;
    }

    .download-buttons {
        justify-content: center;
        margin-top: 15px;
    }

    .footer-bottom .copyright,
    .footer-bottom .footer-menu {
        text-align: center !important;
        margin-bottom: 15px;
    }

    .footer-menu a {
        display: inline-block;
        margin: 5px 10px;
    }
}

@media (max-width: 576px) {
    .footer {
        padding-top: 3rem !important;
    }

    .footer .col-lg-4,
    .footer .col-lg-2,
    .footer .col-lg-3 {
        margin-bottom: 2rem;
    }

    .btn-social {
        width: 45px;
        height: 45px;
        margin: 0 5px;
    }

    .btn-social i {
        font-size: 1.1rem;
    }

    .download-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .btn-download {
        width: 100%;
        max-width: 200px;
    }

    .footer-menu a {
        display: block;
        margin: 5px 0;
    }

    .footer h5::after {
        width: 40px;
    }

    .footer-link:hover {
        padding-left: 15px;
    }

    .footer-link:hover::before {
        width: 10px;
    }
}

/* Animation for footer elements on scroll */
.footer .wow {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* Legacy support for old footer structure */
.footer .btn.btn-link {
    color: rgba(255, 255, 255, 0.7) !important;
    transition: all 0.3s ease;
    padding: 8px 0;
    font-family: 'Kanit', sans-serif !important;
}

.footer .btn.btn-link:hover {
    color: var(--warning) !important;
    transform: translateX(10px);
    background: rgba(245, 213, 71, 0.1);
    padding-left: 10px;
}

/* ========================================= */
/* GLOBAL COMPONENTS */
/* ========================================= */

/* Deer Badge */
.deer-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--warning) 0%, #f39c12 100%);
    color: var(--dark);
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(245, 213, 71, 0.3);
    transition: all 0.3s ease;
}

.deer-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 213, 71, 0.4);
}

/* Buttons */
.btn {
    border-radius: 25px;
    font-weight: 500;
    padding: 12px 30px;
    transition: all 0.3s ease;
}

.btn-light {
    background-color: var(--soft-cream) !important;
    border-color: var(--deer-cream) !important;
    color: var(--primary) !important;
}

.btn-light:hover {
    background-color: var(--deer-cream) !important;
    color: var(--earth-brown) !important;
    transform: translateY(-2px);
}

/* Back to Top Button - แก้ไขให้แสดงได้ */
.back-to-top {
    background: linear-gradient(135deg, #f5d547 0%, #f39c12 100%) !important;
    border: 3px solid var(--white) !important;
    color: var(--dark) !important;
    box-shadow: 0 8px 25px rgba(245, 213, 71, 0.6);
    transition: all 0.3s ease;
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    left: auto !important;
    z-index: 1000 !important;

    /* ลบ properties ที่ทำให้หาย */
    display: none;
    /* ไม่ใส่ !important */
    /* ลบ opacity และ visibility ออก */

    width: 55px !important;
    height: 55px !important;
    border-radius: 50% !important;
    text-decoration: none !important;

    /* เพิ่มการจัดตำแหน่งไอคอน */
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top:hover {
    background: linear-gradient(135deg, #ffffff 0%, #f5d547 100%) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
    transform: translateY(-8px) scale(1.15);
    box-shadow: 0 15px 40px rgba(139, 69, 19, 0.4);
}

.back-to-top i {
    font-size: 1.2rem !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
    }

    .back-to-top i {
        font-size: 1rem !important;
    }
}

/* Form Controls */
.form-control {
    border: 2px solid var(--deer-cream);
    border-radius: 15px;
}

.form-control:focus {
    border-color: var(--forest-green);
    box-shadow: 0 0 0 0.2rem rgba(34, 139, 34, 0.25);
}

/* ========================================= */
/* GLOBAL ANIMATIONS */
/* ========================================= */

@keyframes deerHop {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.deer-animation {
    animation: deerHop 3s ease-in-out infinite;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================= */
/* MOBILE RESPONSIVENESS */
/* ========================================= */

@media (max-width: 768px) {
    .deer-badge {
        font-size: 0.8rem;
        padding: 6px 16px;
    }

    .btn {
        padding: 10px 25px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}