/* 
===================================================================
  TechNova - Complete Responsive Media Queries & Offcanvas Stylesheet
  Breakpoints:
    - Desktop Large: 1200px+
    - Desktop Standard: 993px - 1199px
    - Tablet / Offcanvas Breakpoint: max-width 992px
    - Small Tablet: 577px - 768px
    - Mobile: 0 - 576px (with 425px, 375px, 320px refinements)
===================================================================
*/

/* --- Global Media & Overflow Protection --- */
img, video, iframe, canvas, svg {
  max-width: 100%;
  height: auto;
}

body {
  overflow-x: hidden;
}

/* Brand Logo & Navbar Layout Safeguards */
.navbar-brand,
.brand-logo,
.brand-logo * {
  white-space: nowrap !important;
  word-break: normal !important;
  flex-shrink: 0 !important;
}

/* Sidebar Backdrop Overlay */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1045;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

body.sidebar-open {
  overflow: hidden !important;
}

/* Hide scroll-to-top button when sidebar or modal is open to prevent overlapping elements */
body.sidebar-open .scroll-to-top,
body.sidebar-open #back-to-top {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.scroll-to-top,
#back-to-top {
  z-index: 990 !important;
}

/* --- Utility Visibility Classes Across Breakpoints --- */

/* Mobile Only (0 - 576px) */
@media (min-width: 577px) {
  .d-mobile-only {
    display: none !important;
  }
}

/* Tablet Only (577px - 992px) */
@media (max-width: 576px), (min-width: 993px) {
  .d-tablet-only {
    display: none !important;
  }
}

/* Desktop Only (993px+) */
@media (max-width: 992px) {
  .d-desktop-only {
    display: none !important;
  }
}

/* Sidebar Toggle Element (Mobile & Tablet) */
.sidebar-toggle-btn {
  transition: all 0.25s ease;
}

.sidebar-toggle-btn:hover {
  background: var(--gold, #D4AF37);
  color: #0D0D1A !important;
}

/* ===================================================================
   DESKTOP STYLES (993px and up)
   =================================================================== */
@media (min-width: 993px) {
  .hero-banner {
    padding: 4.5rem 3.5rem;
  }

  .hero-banner h1 {
    font-size: 3.2rem;
  }

  /* Fixed / Sticky Sidebar Widget */
  .sidebar-wrapper {
    position: sticky;
    top: 90px;
    z-index: 10;
  }

  .dashboard-layout {
    display: flex;
    flex-direction: row;
    min-height: calc(100vh - 70px);
  }

  #sidebar {
    width: 270px;
    flex-shrink: 0;
  }

  .dashboard-sidebar {
    width: 270px;
    flex-shrink: 0;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    transform: none !important;
    z-index: 100;
  }

  .dashboard-content {
    flex-grow: 1;
    width: calc(100% - 270px);
    padding: 2rem;
  }

  .form-responsive-50 {
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
  }

  /* Footer 4 Columns Layout */
  .site-footer .row-footer-cols {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 2rem;
  }
}

/* ===================================================================
   TABLET & MOBILE OFFCANVAS SIDEBAR (992px and down)
   =================================================================== */
@media (max-width: 992px) {
  .hero-banner {
    padding: 3rem 2rem;
  }

  .hero-banner h1 {
    font-size: 2.4rem;
  }

  .dashboard-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: auto;
  }

  .dashboard-layout #sidebar {
    position: static;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
  }

  .sidebar-wrapper,
  #sidebar[data-sidebar="sidebar"] {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 0 1.5rem 0 !important;
    padding: 0 !important;
  }

  .dashboard-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 285px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1050 !important;
    background: #0D0D1A !important;
    border-right: 1px solid rgba(212, 175, 55, 0.3) !important;
    border-bottom: none !important;
    transform: translateX(-100%) !important;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.8) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-sidebar.show-sidebar {
    transform: translateX(0) !important;
  }

  .dashboard-content {
    width: 100% !important;
    padding: 1.25rem !important;
  }

  .form-responsive-75 {
    max-width: 85%;
    margin-left: auto;
    margin-right: auto;
  }

  .site-footer .row-footer-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

/* ===================================================================
   TABLET (577px - 768px)
   =================================================================== */
@media (max-width: 768px) {
  .hero-banner {
    padding: 2.5rem 1.5rem;
    text-align: center;
  }

  .hero-banner h1 {
    font-size: 2rem;
  }

  .hero-banner .d-flex {
    justify-content: center;
  }

  .blog-card-title {
    font-size: 1.15rem;
  }

  .blog-card-body {
    padding: 1.25rem;
  }

  .form-responsive-75 {
    max-width: 100%;
  }

  .site-footer .row-footer-cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .dashboard-content {
    padding: 1.25rem !important;
  }
}

/* ===================================================================
   MOBILE (0 - 576px)
   =================================================================== */
@media (max-width: 576px) {
  /* Navigation: Hamburger menu & full-width buttons */
  .main-navbar .navbar-collapse {
    background: rgba(13, 13, 26, 0.98);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(212, 175, 55, 0.2));
    margin-top: 0.75rem;
  }

  .main-navbar .navbar-collapse .d-flex {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem !important;
    margin-top: 1rem;
  }

  .main-navbar .btn {
    width: 100%;
    text-align: center;
  }

  /* Hero: Smaller typography & stacked buttons */
  .hero-banner {
    padding: 2rem 1.25rem;
    border-radius: 16px;
    text-align: center;
  }

  .hero-banner h1 {
    font-size: 1.65rem;
    line-height: 1.3;
  }

  .hero-banner p.lead {
    font-size: 0.95rem;
  }

  .hero-banner .btn-gold, 
  .hero-banner .btn-outline-gold {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  /* Cards: 1 Column Full Width & Wrapping */
  .blog-card {
    border-radius: 12px;
  }

  .blog-card-title {
    font-size: 1.1rem;
    word-break: break-word;
  }

  .stat-card {
    padding: 0.85rem 0.75rem !important;
    gap: 0.6rem !important;
    border-radius: 12px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .stat-card .stat-icon {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
  }

  .stat-card .stat-icon i {
    font-size: 1.2rem !important;
  }

  .stat-card h3 {
    font-size: 1.15rem !important;
    line-height: 1.2 !important;
  }

  .stat-card span {
    font-size: 0.72rem !important;
    line-height: 1.15 !important;
    display: block !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  /* Forms: Full width on mobile */
  .form-control, .form-select, .input-group {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 0.92rem;
  }

  /* Input Group Layout Preservations */
  .input-group {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
  }

  .input-group > .input-group-text {
    width: auto !important;
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .input-group > .form-control {
    flex: 1 1 auto !important;
    width: 1% !important;
    min-width: 0 !important;
  }

  .input-group > .btn {
    width: auto !important;
    flex: 0 0 auto !important;
  }

  .card.p-md-5, .card.p-4 {
    padding: 1.25rem !important;
  }

  /* Tables: Horizontal Scroll Wrapper */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    margin-bottom: 0;
  }

  .table {
    min-width: 550px;
    font-size: 0.85rem;
  }

  .table th, .table td {
    white-space: nowrap;
    padding: 0.6rem 0.75rem;
  }

  /* Modals: Viewport Bounds */
  .modal-dialog {
    margin: 0.5rem auto;
    max-width: calc(100% - 1rem);
  }

  .modal-content {
    border-radius: 14px;
  }

  /* Comments: Reduced indent & padding */
  .comments-section .card {
    padding: 0.85rem !important;
  }

  .comments-section .d-flex {
    gap: 0.6rem !important;
  }

  .comments-section img {
    width: 32px !important;
    height: 32px !important;
  }

  /* Compact Pagination */
  .pagination .page-link {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
  }

  /* Footer: 1 Column */
  .site-footer {
    padding-top: 2.5rem;
    text-align: center;
  }

  .site-footer .row-footer-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .site-footer .social-links {
    justify-content: center;
  }

  .dashboard-content {
    padding: 1rem !important;
  }
}

/* ===================================================================
   EXTRA SMALL MOBILE (320px - 425px)
   =================================================================== */
@media (max-width: 425px) {
  .font-heading {
    word-break: break-word;
  }

  .hero-section h1 {
    font-size: 1.45rem !important;
  }

  .hero-section .badge {
    font-size: 0.65rem !important;
  }

  .table {
    min-width: 500px;
  }

  .btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
  }
}

