/*
 * ============================================================
 * responsive.css — Global Responsive & Typography Improvements
 * Deeco Technic Website
 * ============================================================
 * ใช้ร่วมกันทุกหน้าทั้ง frontend และ admin
 * ครอบคลุม: mobile (≤576px), tablet (≤768px), desktop (≥992px)
 * ============================================================
 */

/* ───────────────────────────────────────────
   1. BASE — Font scale & readability
─────────────────────────────────────────── */
html {
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  word-break: break-word;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

/* ───────────────────────────────────────────
   2. ADMIN — Floating dropdown-container nav
─────────────────────────────────────────── */
.dropdown-container {
  flex-wrap: wrap !important;
  gap: 10px !important;
  padding: 10px 16px !important;
}

.dropdown-container label {
  font-size: clamp(14px, 3vw, 22px) !important;
  white-space: nowrap;
  margin-bottom: 0 !important;
}

.form-menu {
  min-width: 0 !important;
  width: 100%;
  max-width: 320px;
}

@media (max-width: 576px) {
  .dropdown-container {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .dropdown-container label {
    font-size: 18px !important;
  }

  .form-menu {
    max-width: 100% !important;
    width: 100% !important;
  }

  .dropdown-container .ms-auto {
    margin-left: 0 !important;
    width: 100%;
  }

  .dropdown-container .btn {
    width: 100%;
    text-align: center;
  }
}

/* ───────────────────────────────────────────
   3. ADMIN — settings-card padding on mobile
─────────────────────────────────────────── */
@media (max-width: 768px) {
  .settings-card {
    padding: 16px !important;
    border-radius: 12px !important;
  }

  .table-card {
    padding: 14px !important;
    border-radius: 12px !important;
  }

  .main-card {
    border-radius: 12px !important;
  }
}

@media (max-width: 576px) {
  .settings-card {
    padding: 12px !important;
  }

  .section-title {
    font-size: 1rem !important;
  }

  .preview-box {
    height: 200px !important;
  }
}

/* ───────────────────────────────────────────
   4. ADMIN — preset-grid festival cards
─────────────────────────────────────────── */
.preset-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
}

@media (max-width: 576px) {
  .preset-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .preset-card {
    padding: 10px !important;
    font-size: 0.82rem !important;
  }

  .preset-card .preset-icon {
    font-size: 1.3rem !important;
  }
}

/* ───────────────────────────────────────────
   5. ADMIN — header action row
─────────────────────────────────────────── */
@media (max-width: 576px) {
  .d-flex.flex-column.flex-md-row,
  .d-flex.flex-column.flex-sm-row {
    flex-direction: column !important;
  }

  .d-flex.align-items-center.gap-2 {
    flex-wrap: wrap;
  }

  /* buttons should take full width on tiny phones */
  .btn-primary.rounded-pill,
  .btn-outline-secondary.rounded-pill {
    width: 100%;
    text-align: center;
  }
}

/* ───────────────────────────────────────────
   6. ADMIN — bot_settings dropdown-container (custom)
─────────────────────────────────────────── */
@media (max-width: 768px) {
  .dropdown-container {
    position: relative !important;
    top: 0 !important;
  }
}

/* ───────────────────────────────────────────
   7. ADMIN — sticky right column
─────────────────────────────────────────── */
@media (max-width: 991px) {
  .col-lg-5 .settings-card.sticky-top,
  .sticky-top {
    position: relative !important;
    top: auto !important;
  }
}

/* ───────────────────────────────────────────
   8. ADMIN — event_log table
─────────────────────────────────────────── */
.main-container {
  padding: 0 12px !important;
}

.top-bar {
  flex-direction: row;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .main-container {
    margin: 15px auto !important;
  }

  .top-bar {
    flex-direction: column !important;
    gap: 12px !important;
  }

  .top-bar h2 {
    font-size: 1.3rem !important;
  }

  .stat-card {
    padding: 14px !important;
  }

  .stat-icon {
    width: 42px !important;
    height: 42px !important;
    font-size: 18px !important;
  }

  .table-custom {
    font-size: 12px !important;
  }

  .table-custom th,
  .table-custom td {
    padding: 8px 6px !important;
  }

  .filter-section {
    padding: 12px !important;
  }

  .table-card {
    padding: 15px !important;
  }
}

@media (max-width: 576px) {
  .top-bar .d-flex.gap-2 {
    flex-wrap: wrap;
    width: 100%;
  }

  .top-bar .d-flex.gap-2 > * {
    flex: 1 1 auto;
  }
}

/* ───────────────────────────────────────────
   9. FRONTEND — section padding mobile
─────────────────────────────────────────── */
@media (max-width: 768px) {
  section {
    padding: 50px 0 !important;
  }

  .section-header {
    padding-bottom: 40px !important;
  }

  .section-header h2 {
    font-size: 24px !important;
  }
}

@media (max-width: 576px) {
  section {
    padding: 36px 0 !important;
  }

  .section-header h2 {
    font-size: 20px !important;
  }

  .section-header p {
    font-size: 14px !important;
  }
}

/* ───────────────────────────────────────────
   10. FRONTEND — hero / banner headings
─────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero h1,
  .hero h2,
  .hero-section h1 {
    font-size: clamp(1.6rem, 6vw, 2.4rem) !important;
    line-height: 1.25 !important;
  }

  .hero p,
  .hero-section p {
    font-size: clamp(0.9rem, 3vw, 1rem) !important;
  }
}

/* ───────────────────────────────────────────
   11. GENERAL — tables overflow on mobile
─────────────────────────────────────────── */
.table-responsive-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  word-break: normal;
}

/* ───────────────────────────────────────────
   12. GENERAL — form-control better on mobile
─────────────────────────────────────────── */
@media (max-width: 576px) {
  .form-control,
  .form-select {
    font-size: 15px !important;
    padding: 8px 10px !important;
  }

  label.form-label {
    font-size: 13px !important;
  }
}

/* ───────────────────────────────────────────
   13. GENERAL — btn sizes on mobile
─────────────────────────────────────────── */
@media (max-width: 576px) {
  .btn {
    font-size: 13px !important;
    padding: 7px 14px !important;
  }

  .btn-sm {
    font-size: 12px !important;
    padding: 5px 10px !important;
  }
}

/* ───────────────────────────────────────────
   14. TYPOGRAPHY — readable line-height
─────────────────────────────────────────── */
p, li, td, label, span {
  line-height: 1.65;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
}

/* ───────────────────────────────────────────
   15. ADMIN — bot_settings card body
─────────────────────────────────────────── */
@media (max-width: 576px) {
  .card-header-gradient {
    padding: 1rem !important;
  }

  .card-header-gradient h4,
  .card-header-gradient h5 {
    font-size: 1rem !important;
  }

  .log-terminal {
    font-size: 0.75rem !important;
    max-height: 200px !important;
  }
}

/* ───────────────────────────────────────────
   16. ADMIN — website_update modal preview
─────────────────────────────────────────── */
@media (max-width: 576px) {
  .modal-update-preview {
    max-width: 100% !important;
  }

  .modal-update-header {
    padding: 16px !important;
  }

  .modal-update-body {
    padding: 16px !important;
    max-height: 45vh !important;
  }

  .modal-update-footer {
    padding: 12px 16px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
  }
}

/* ───────────────────────────────────────────
   17. ADMIN — Stat box / KPI cards row
─────────────────────────────────────────── */
@media (max-width: 576px) {
  .col-sm-6.col-lg-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* ───────────────────────────────────────────
   18. Cookie consent responsive
─────────────────────────────────────────── */
@media (max-width: 576px) {
  #cookie-consent {
    padding: 12px 14px !important;
    font-size: 13px !important;
  }

  #cookie-consent > div {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: flex-start !important;
  }

  #accept-cookie {
    width: 100% !important;
    text-align: center;
  }
}

/* ───────────────────────────────────────────
   19. FRONTEND — navbar mobile
─────────────────────────────────────────── */
@media (max-width: 1279px) {
  .navbar {
    padding: 0 !important;
  }

  .navbar-logo img {
    max-height: 50px !important;
  }
}

/* ───────────────────────────────────────────
   20. Dark mode — readable text on mobile
─────────────────────────────────────────── */
[data-theme="dark"] .text-muted {
  color: #94a3b8 !important;
}

[data-theme="dark"] .form-label {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .dropdown-container {
  color: #e2e8f0;
}

/* ───────────────────────────────────────────
   21. FRONTEND — Products Intro Section (< 768px: Text above Media)
─────────────────────────────────────────── */
.product-intro-container {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.product-intro-media .watch-video iframe {
  max-width: 100%;
  border-radius: 12px;
}

@media (max-width: 767.98px) {
  .product-intro-container,
  div:has(> div[style*="flex: 1; padding: 3px"]) {
    flex-direction: column !important;
    gap: 20px !important;
  }

  .product-intro-container .product-intro-text,
  .product-intro-container > div:first-child {
    width: 100% !important;
    flex: none !important;
    order: 1 !important;
  }

  .product-intro-container .product-intro-media,
  div[style*="flex: 1; padding: 3px"] {
    width: 100% !important;
    flex: none !important;
    order: 2 !important;
    padding: 0 !important;
  }

  .product-intro-media .watch-video,
  div[style*="flex: 1; padding: 3px"] .watch-video {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }

  .product-intro-media .watch-video iframe,
  div[style*="flex: 1; padding: 3px"] iframe {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 16/9 !important;
  }

  .product-intro-media .product-thumbnail-strip,
  div[style*="flex: 1; padding: 3px"] .product-thumbnail-strip {
    justify-content: center !important;
    margin-top: 15px !important;
  }
}

/* ───────────────────────────────────────────
   22. HEADER — Logo and Title inline row
─────────────────────────────────────────── */
.header .logo {
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

.header .logo img {
  max-height: 88px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  margin-right: 8px !important;
  flex-shrink: 0 !important;
  transition: max-height 0.3s ease;
}

@media (max-width: 1199.98px) and (min-width: 769px) {
  .header .logo img {
    max-height: 68px !important;
  }
}

@media (max-width: 768px) {
  .header .logo img {
    max-height: 52px !important;
  }
}

.header .logo h5,
.header .logo h1 {
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap !important;
  display: inline-block !important;
  line-height: 1.2 !important;
  vertical-align: middle !important;
}

/* ───────────────────────────────────────────
   23. CONTACT — Form Frame Responsive
─────────────────────────────────────────── */
@media (max-width: 576px) {
  .contact .order-lg-2 {
    padding: 10px !important;
  }

  .contact .php-email-form {
    padding: 20px 15px !important;
  }
}

/* ───────────────────────────────────────────
   24. UPTIME STATUS BADGE — Mobile Text Hidden
─────────────────────────────────────────── */
body.mobile-nav-active #uptime-status-badge {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease;
}

@media (max-width: 768px) {
  #uptime-status-badge {
    top: 108px !important;
    left: 15px !important;
    bottom: auto !important;
    width: 28px !important;
    max-width: 28px !important;
    height: 30px !important;
    overflow: hidden !important;
    border-radius: 6px !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
  }
}



