/*
Theme Name: Di Tích Lâm Đồng
Theme URI: https://ditichlamdong.com
Author: Quản trị viên
Description: Giao diện WordPress tùy chỉnh cho website Di Tích Lâm Đồng.
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: di-tich-lam-dong
*/

/* ==============================
   RESET
============================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  line-height: 1.6;
  background: #f4f4f4;
  color: #333;
}
a {
  text-decoration: none;
  transition: 0.3s;
}

/* ==============================
   HEADER
============================== */
.site-header {
  background: #003366;
  color: #fff;
  padding: 12px 20px;
}
.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo */
.logo img {
  height: 80px;
  width: auto;
  margin-right: 25px;
}

/* Menu */
.main-nav .menu {
  list-style: none !important;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}
.main-nav .menu li {
  list-style: none !important;
  position: relative;
}
.main-nav .menu li a {
  color: #fff;
  font-weight: 600;
  padding: 6px 10px;
}
.main-nav .menu li a:hover {
  background: #0066CC;
  border-radius: 4px;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Language Switch */
.lang-switch select,
.lang-switch .switcher {
  margin: 0 !important;
  padding: 6px 10px !important;
  border-radius: 4px;
  border: none;
  font-weight: bold;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 4px;
  padding: 2px 5px;
  position: relative;
}
#search-input {
  border: none;
  outline: none;
  padding: 6px 8px;
  width: 170px;
}
#voice-btn,
#search-btn {
  background: #006699;
  color: #fff;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 3px;
  margin-left: 3px;
}
#voice-btn:hover,
#search-btn:hover {
  background: #3399CC;
  color: #000;
}

/* Auth Links */
.auth-links a {
  color: #fff;
  font-weight: 600;
}
.auth-links a:hover {
  color: #66CCFF;
}

/* ==============================
   HERO SECTION
============================== */
.hero {
  background: linear-gradient(rgba(0,51,102,0.6), rgba(0,51,102,0.6)), 
              url('https://picsum.photos/1600/500?random') no-repeat center center/cover;
  color: #fff;
  padding: 100px 20px;
  text-align: center;
}
.hero h1 {
  font-size: 2.8em;
  margin-bottom: 15px;
  text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}
.hero p {
  font-size: 1.3em;
}

/* ==============================
   MAIN CONTENT
============================== */
main {
  max-width: 1200px;
  margin: 30px auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Latest Posts */
.latest-posts {
  padding: 40px 20px;
  max-width: 1000px;
  margin: auto;
}
.latest-posts h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #003366;
}
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.post-item {
  background: #fff;
  border: 1px solid #eee;
  padding: 15px;
  border-radius: 5px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.post-item h3 a {
  color: #0066CC;
}
.post-item h3 a:hover {
  text-decoration: underline;
  color: #3399FF;
}

/* ==============================
   FOOTER
============================== */
footer {
  background: #003366;
  color: #fff;
  text-align: center;
  padding: 15px;
  margin-top: 30px;
  font-size: 0.9em;
}
footer a {
  color: #66CCFF;
}
footer a:hover {
  color: #3399FF;
}

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 900px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .main-nav .menu {
    flex-direction: column;
    width: 100%;
  }
  .main-nav .menu li {
    margin: 5px 0;
  }
  .search-box {
    width: 100%;
  }
  #search-input {
    flex: 1;
  }
  .hero h1 {
    font-size: 2em;
  }
  .hero p {
    font-size: 1em;
  }
}

/* ==============================
   MENU DROPDOWN (Submenu)
============================== */
.main-nav .menu li ul.sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #003366;
  padding: 10px 0;
  min-width: 200px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 9999;
}
.main-nav .menu li:hover > ul.sub-menu {
  display: block;
}
.main-nav .menu li ul.sub-menu li a {
  display: block;
  padding: 8px 15px;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
}
.main-nav .menu li ul.sub-menu li a:hover {
  background: #0066CC;
  color: #fff;
}

/* ==============================
   SEARCH DROPDOWN RESULTS
============================== */
#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  width: 280px;
  border: 1px solid #ccc;
  display: none;
  z-index: 1000;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  max-height: 300px;
  overflow-y: auto;
}
#search-results ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
#search-results li {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}
#search-results li a {
  color: #003366;
  display: block;
  font-weight: 500;
}
#search-results li a:hover {
  background: #f0f0f0;
}
#search-results .no-results {
  padding: 10px;
  color: #000; /* chữ đen */
  font-style: italic;
  text-align: center;
}

/* Highlight kết quả tìm kiếm */
.search-highlight {
  font-weight: bold;
  color: #0066cc;   /* xanh lam đậm */
  background: #e6f2ff; /* nền xanh nhạt để nổi bật */
  padding: 0 2px;
  border-radius: 2px;
}

/* === GIAO DIỆN DIỄN ĐÀN CỘNG ĐỒNG === */
.forum-container {
  max-width: 800px;
  margin: 40px auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 20px;
}

.forum-container h3 {
  margin-bottom: 15px;
  font-weight: 600;
  color: #003366;
  display: flex;
  align-items: center;
}

#forum-form textarea {
  width: 100%;
  resize: none;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
}

#forum-form button {
  background: #004080;
  color: #fff;
  padding: 8px 20px;
  border: none;
  border-radius: 5px;
  margin-top: 8px;
  cursor: pointer;
  transition: 0.2s;
}
#forum-form button:hover {
  background: #0055b3;
}

/* === Bài viết === */
.post {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 15px;
  margin-bottom: 20px;
  background: #fafafa;
  transition: all 0.2s ease;
}
.post:hover {
  background: #f5f8ff;
}

.post strong {
  color: #003366;
}

.post small {
  color: #777;
}

.btn-like {
  border: none;
  background: none;
  color: #e63946;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}
.btn-like:hover {
  color: #cc0000;
}

/* === Bình luận === */
#forum-posts .comment-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

#forum-posts .comment-form input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#forum-posts .comment-form button {
  padding: 6px 10px;
  background: #004080;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
}

#forum-posts .comment-form button:hover {
  background: #0055b3;
}

/* === Load more button === */
#load-more {
  padding: 8px 20px;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.2s;
}
#load-more:hover {
  background: #ddd;
}

/* === Avatar & user info === */
.post > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.post img.avatar {
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

/* === Footer cố định === */
footer, .site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #002b5c; /* màu nền tùy bạn */
    color: #fff;
    text-align: center;
    padding: 10px 0;
    z-index: 100;
}

/* === Slider Tin Mới === */
.news-slider-wrapper {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  padding: 15px;
  margin: 30px auto;
  max-width: 950px;
  overflow: hidden;
}

.news-slider {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 15px;
  padding-bottom: 10px;
}

.news-item {
  flex: 0 0 auto;
  width: 220px;
  background: #f7f7f7;
  border-radius: 6px;
  text-align: center;
  padding: 8px;
  transition: all 0.3s;
}

.news-item:hover {
  background: #eaf3ff;
  transform: translateY(-3px);
}

.news-thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 4px;
}

.news-item h4 {
  font-size: 15px;
  margin-top: 8px;
  color: #004080;
}

/* ==============================
   HEADER RESPONSIVE (Mobile)
   ============================== */

/* --- Nút menu hamburger mặc định --- */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 32px;
  height: 26px;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  height: 3px;
  background: #fff;
  margin: 4px 0;
  border-radius: 2px;
  transition: 0.3s;
}

/* ==============================
   GIAO DIỆN DI ĐỘNG (≤991px)
============================== */
@media (max-width: 991px) {

  /* Tổng thể header chia 2 hàng */
  .header-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    position: relative;
  }

  /* === HÀNG 1: Logo + Thanh tìm kiếm === */
  .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .logo img {
    height: 52px;
    width: auto;
  }

  .search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 5px;
    padding: 3px 5px;
    width: 180px;
  }

  #search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 5px;
    font-size: 14px;
  }

  #voice-btn,
  #search-btn {
    border: none;
    background: #006699;
    color: #fff;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 16px;
    cursor: pointer;
  }

  /* === HÀNG 2: Menu + Đăng nhập/Đăng ký === */
  .header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 28px;
    height: 22px;
  }

  .menu-toggle span {
    height: 3px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    margin: 3px 0;
  }

  .auth-links {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
  }

  .auth-links a {
    color: #fff;
  }

  .auth-links a:hover {
    color: #66ccff;
  }

  /* === MENU XỔ XUỐNG === */
  .main-nav {
    display: none;
    width: 100%;
    background: #003366;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 10px;
  }

  .main-nav.active {
    display: block;
  }

  .main-nav .menu {
    flex-direction: column;
    width: 100%;
    padding: 10px 0;
  }

  .main-nav .menu li {
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .main-nav .menu li a {
    display: block;
    color: #fff;
    padding: 12px 20px;
  }

  .main-nav .menu li a:hover {
    background: #0066cc;
  }

  /* Ẩn layout cũ cho di động */
  .header-right {
    display: none;
  }
}

/* ==============================
   GIAO DIỆN PC/LAPTOP (≥992px)
============================== */
@media (min-width: 992px) {
  .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }

  /* Giữ layout cũ */
  .menu-toggle {
    display: none;
  }

  .main-nav {
    display: flex !important;
    align-items: center;
  }

  .main-nav .menu {
    display: flex;
    gap: 20px;
    list-style: none;
  }

  .main-nav .menu li a {
    color: #fff;
    font-weight: 600;
    padding: 6px 10px;
  }

  .main-nav .menu li a:hover {
    background: #0066cc;
    border-radius: 4px;
  }

  .header-top,
  .header-bottom {
    display: contents;
  }
}

/* ==============================
   FIX HEADER MOBILE – căn lại layout gọn gàng
============================== */
@media (max-width: 991px) {

  /* Tổng thể */
  .header-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    position: relative;
  }

  /* === HÀNG 1: Logo bên trái + menu bên phải === */
  .logo {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .logo img {
    height: 50px;
    width: auto;
  }

  .menu-toggle {
    position: absolute;
    top: 15px;
    right: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 28px;
    height: 22px;
    cursor: pointer;
  }

  .menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    margin: 3px 0;
  }

  /* === HÀNG 2: Thanh tìm kiếm + Đăng nhập/Đăng ký === */
  .header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  .search-box {
    flex: 1;
    max-width: 65%;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 5px;
    padding: 3px 5px;
  }

  #search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 5px;
    font-size: 14px;
  }

  #voice-btn,
  #search-btn {
    border: none;
    background: #006699;
    color: #fff;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 16px;
    cursor: pointer;
  }

  /* === Liên kết đăng nhập bên phải === */
  .auth-links {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
  }

  .auth-links a {
    color: #fff;
  }

  .auth-links a:hover {
    color: #66ccff;
  }

  /* === MENU xổ xuống === */
  .main-nav {
    display: none;
    width: 100%;
    background: #003366;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 10px;
  }

  .main-nav.active {
    display: block;
  }

  .main-nav .menu {
    flex-direction: column;
    width: 100%;
    padding: 10px 0;
  }

  .main-nav .menu li {
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .main-nav .menu li a {
    display: block;
    color: #fff;
    padding: 12px 20px;
  }

  .main-nav .menu li a:hover {
    background: #0066cc;
  }
}

/* ==============================
   ✅ FIX MOBILE HEADER 
============================== */

/* --- 1️⃣ Fix thanh tìm kiếm trong header di động --- */
@media (max-width: 991px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .search-box {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-radius: 6px;
    padding: 4px 6px;
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
  }

  #search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 6px;
    font-size: 14px;
    width: 100%;
  }

  #voice-btn,
  #search-btn {
    background: #006699;
    color: #fff;
    border: none;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
  }

  #voice-btn:hover,
  #search-btn:hover {
    background: #3399CC;
  }
}

