/* Comprehensive UI Fixes - Perfect Website Design */

:root {
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  --glass-blur: 12px;
}

[data-theme="dark"] {
  --glass-bg: rgba(15, 23, 42, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* Global Entrance Animation */
@keyframes pageReveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

body {
  animation: pageReveal 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: background-color 0.5s ease, color 0.5s ease;
  overflow-x: hidden !important;
  width: 100%;
}

html {
    overflow-x: hidden !important;
}

/* Fix for Bootstrap Row Overflow */
.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--bs-gutter-y));
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* Smooth Theme Transitions */
.navbar, .card, .glass, .btn, .footer-compact, .list-group-item, .footer-copy, .section-label {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease, backdrop-filter 0.5s ease !important;
}

/* Glassmorphism Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-hover:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--accent);
  transform: translateY(-5px);
  transition: all 0.3s ease;
}

[data-theme="dark"] .glass-hover:hover {
  background: rgba(30, 41, 59, 0.8);
}

/* ===== BUTTON OVERLAP FIXES ===== */

/* Base button improvements */
.btn {
  position: relative;
  z-index: 1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Button spacing fixes */
.d-flex .btn {
  margin: 0.25rem;
}

.d-flex.gap-2 .btn {
  margin: 0;
}

.d-flex.gap-3 .btn {
  margin: 0;
}

.btn-group .btn {
  margin: 0;
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.btn-group .btn:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Button size variations */
.btn-sm {
  min-height: 36px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  min-height: 52px;
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-xl {
  min-height: 60px;
  padding: 1.25rem 2.5rem;
  font-size: 1.25rem;
}

/* ===== BUTTON COLOR SCHEMES ===== */

.btn-primary {
  background: linear-gradient(135deg, #2e7d32 0%, #43a047 100%);
  border-color: #2e7d32;
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
  border-color: #1b5e20;
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #388e3c 0%, #4caf50 100%);
  border-color: #388e3c;
  color: white;
}

.btn-success:hover {
  background: linear-gradient(135deg, #1b5e20 0%, #388e3c 100%);
  border-color: #1b5e20;
  color: white;
}

.btn-outline-success {
  background: transparent;
  border-color: #2e7d32;
  color: #2e7d32;
}

.btn-outline-success:hover {
  background: #2e7d32;
  color: white;
}

.btn-outline-primary {
  background: transparent;
  border-color: #2e7d32;
  color: #2e7d32;
}

.btn-outline-primary:hover {
  background: #2e7d32;
  color: white;
}

.btn-outline-secondary {
  background: transparent;
  border-color: #64748b;
  color: #64748b;
}

.btn-outline-secondary:hover {
  background: #64748b;
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  border-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
  border-color: #dc2626;
  color: white;
}

.btn-outline-danger {
  background: transparent;
  border-color: #ef4444;
  color: #ef4444;
}

.btn-outline-danger:hover {
  background: #ef4444;
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  border-color: #f59e0b;
  color: white;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
  border-color: #d97706;
  color: white;
}

.btn-light {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}

.btn-light:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

/* ===== MOBILE OPTIMIZATIONS & OVERLAP FIXES ===== */

@media (max-width: 768px) {
  /* Prevent content from being hidden behind sticky navbar */
  body {
    padding-top: 0; /* Adjust if navbar is fixed */
  }

  /* Improved spacing for flex containers */
  .d-flex {
    flex-wrap: wrap;
    gap: 1rem !important;
  }

  /* Ensure buttons don't overlap or touch */
  .btn {
    width: 100%;
    margin-bottom: 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .btn-group {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    border-radius: 8px !important;
    margin-bottom: 0.25rem !important;
  }

  /* Card spacing */
  .card {
    margin-bottom: 1.5rem !important;
  }

  /* Section padding */
  section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  /* Hero text overlap fixes */
  .hero-title {
    font-size: 2.5rem !important;
    line-height: 1.2 !important;
  }

  .hero-subtitle {
    font-size: 0.9rem !important;
    margin-bottom: 1.5rem !important;
    max-width: 100% !important;
  }

  /* Navbar Brand Fitting for small screens */
  .brand-title {
    font-size: 1rem !important;
  }
  .brand-subtitle {
    font-size: 0.6rem !important;
  }
  .navbar-brand img {
    width: 32px !important;
    height: 32px !important;
  }

  /* Table responsiveness */
  .table-responsive {
    border: 0;
    margin-bottom: 1rem;
  }
}

/* ===== ACCESSIBILITY & TOUCH TARGETS ===== */
a, button, select, input {
  min-height: 44px;
}

/* Fix for overlapping elements in absolute positioning */
.relative-container {
  position: relative;
}

.overflow-hidden {
  overflow: hidden;
}

/* Ensure images don't overflow containers */
img {
  max-width: 100%;
  height: auto;
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle-btn {
  font-size: 1.25rem;
  padding: 0.5rem !important;
  color: var(--text-main) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  transition: background-color 0.3s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--accent-light);
  transform: none !important;
}

[data-theme="dark"] .theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-icon-light {
  display: inline-block !important;
}

/* Specific Dark Mode Fixes */
[data-theme="dark"] .navbar {
  background-color: var(--surface) !important;
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .card {
  background-color: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .modal-content {
  background-color: var(--surface);
  color: var(--text-main);
  border-color: var(--border);
}

[data-theme="dark"] .dropdown-menu {
  background-color: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .dropdown-item {
  color: var(--text-main);
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: var(--background-alt);
}

[data-theme="dark"] .form-control, 
[data-theme="dark"] .form-select {
  background-color: var(--background);
  border-color: var(--border);
  color: var(--text-main);
}

[data-theme="dark"] .text-muted {
  color: var(--text-light) !important;
}

[data-theme="dark"] .bg-light {
  background-color: var(--background) !important;
}

[data-theme="dark"] .table {
  color: var(--text-main);
}

[data-theme="dark"] .table-light {
  background-color: var(--background-alt) !important;
}

/* Global Dark Mode Overrides for Better Visibility */
[data-theme="dark"], 
[data-theme="dark"] body {
  background-color: var(--background) !important;
  color: var(--text-body) !important;
}

[data-theme="dark"] main,
[data-theme="dark"] section,
[data-theme="dark"] .container-fluid,
[data-theme="dark"] .container {
  background-color: transparent;
}

[data-theme="dark"] .bg-light {
  background-color: var(--background-alt) !important;
}

[data-theme="dark"] .bg-white {
  background-color: var(--surface) !important;
}

[data-theme="dark"] .card {
  background-color: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .card-header, 
[data-theme="dark"] .card-footer {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6, 
[data-theme="dark"] .display-1, 
[data-theme="dark"] .display-2, 
[data-theme="dark"] .display-3, 
[data-theme="dark"] .display-4 {
  color: var(--text-main);
}

[data-theme="dark"] .navbar {
  background-color: var(--surface) !important;
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .navbar-brand, 
[data-theme="dark"] .nav-link {
  color: var(--text-main) !important;
}

[data-theme="dark"] .nav-link:hover {
  color: var(--accent) !important;
}

[data-theme="dark"] .dropdown-menu {
  background-color: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .dropdown-item {
  color: var(--text-body);
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: var(--background-alt);
  color: var(--text-main);
}

[data-theme="dark"] .modal-content {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text-body);
}

[data-theme="dark"] .modal-header, 
[data-theme="dark"] .modal-footer {
  border-color: var(--border);
}

[data-theme="dark"] .form-control, 
[data-theme="dark"] .form-select, 
[data-theme="dark"] .input-group-text {
  background-color: var(--background-alt);
  border-color: var(--border);
  color: var(--text-main);
}

[data-theme="dark"] .form-control:focus, 
[data-theme="dark"] .form-select:focus {
  background-color: var(--surface);
  border-color: var(--accent);
  color: var(--text-main);
}

[data-theme="dark"] .table {
  color: var(--text-body);
  border-color: var(--border);
}

[data-theme="dark"] .table thead th {
  background-color: var(--background-alt);
  color: var(--text-main);
  border-color: var(--border);
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .badge.bg-light {
  background-color: var(--background-alt) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .alert-light {
  background-color: var(--background-alt);
  border-color: var(--border);
  color: var(--text-main);
}

[data-theme="dark"] .text-dark {
  color: var(--text-main) !important;
}

[data-theme="dark"] .text-muted {
  color: var(--text-muted) !important;
}

[data-theme="dark"] hr {
  background-color: var(--border);
  opacity: 0.2;
}

[data-theme="dark"] .list-group-item {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text-body);
}

[data-theme="dark"] .bg-white {
  background-color: var(--surface) !important;
}

[data-theme="dark"] .bg-light {
  background-color: var(--background-alt) !important;
}

[data-theme="dark"] footer {
  background-color: var(--surface) !important;
  border-top: 1px solid var(--border);
}

/* Fix for specific sections that might have hardcoded colors */
[data-theme="dark"] section {
  background-color: var(--background);
}

[data-theme="dark"] .hero-section {
  background-color: var(--background-alt);
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Improved Toggle Icon Visibility in Admin */
[data-theme="dark"] .theme-icon-light.text-warning {
  color: #fbbf24 !important;
}

[data-theme="light"] .theme-icon-dark.text-white {
  color: #1e293b !important;
}

/* Profile and Auth fixes */
[data-theme="dark"] .auth-body {
    background-image: linear-gradient(rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.95)), url('/images/background.jpg') !important;
}

[data-theme="dark"] .input-group {
    background-color: var(--background-alt) !important;
}

[data-theme="dark"] .input-group:focus-within {
    background-color: var(--surface) !important;
}

[data-theme="dark"] .navbar.bg-success,
[data-theme="dark"] .bg-success {
    background-color: var(--accent) !important;
}

[data-theme="dark"] .text-success {
    color: var(--accent) !important;
}

[data-theme="dark"] .btn-success {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

[data-theme="dark"] .btn-success:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

[data-theme="dark"] .btn-outline-success {
    color: var(--accent);
    border-color: var(--accent);
}

[data-theme="dark"] .btn-outline-success:hover {
    background-color: var(--accent);
    color: #fff;
}

[data-theme="dark"] .profile-header,
[data-theme="dark"] .admin-header,
[data-theme="dark"] .contact-hero {
    background: var(--gradient-surface) !important;
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .profile-header h1,
[data-theme="dark"] .admin-header h1,
[data-theme="dark"] .contact-hero h1 {
    color: var(--text-main);
}

[data-theme="dark"] .breadcrumb-item a {
    color: var(--accent) !important;
}

[data-theme="dark"] .breadcrumb-item.active {
    color: var(--text-muted);
}

[data-theme="dark"] .card-title {
    color: var(--text-main);
}

[data-theme="dark"] .stat-card {
    background-color: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .stat-number {
    color: var(--text-main);
}

[data-theme="dark"] .stat-label {
    color: var(--text-muted);
}

[data-theme="dark"] .admin-login-card {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .admin-form-control {
    background: var(--background-alt);
    border-color: var(--border);
    color: var(--text-main) !important;
}

[data-theme="dark"] .admin-form-control:focus {
    background: var(--surface);
    border-color: var(--accent);
}

/* Admin Navbar Theme Fixes */
.admin-main-nav {
  background-color: #1e293b; /* Slate 800 */
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-main-nav .navbar-brand,
.admin-main-nav .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
}

.admin-main-nav .nav-link:hover {
  color: #fff !important;
}

[data-theme="dark"] .admin-main-nav {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .admin-main-nav .navbar-brand,
[data-theme="dark"] .admin-main-nav .nav-link {
  color: var(--text-main) !important;
}

/* Global Table & Layout Overlap Fixes */
.table {
  width: 100%;
  margin-bottom: 1rem;
  color: var(--text-body);
  vertical-align: top;
  border-color: var(--border);
}

.table th, .table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

/* Allow plant names to wrap in bills to avoid overlap */
.table-items .plant-name-col, 
.table-items td:nth-child(3),
.invoice-card .table td:nth-child(2) {
  white-space: normal !important;
  word-break: break-word;
}

.stat-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stat-number {
  word-break: break-all;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .invoice-card {
    padding: 20px !important;
  }
  
  .table-responsive {
    border: 0;
    margin-bottom: 0;
  }

  /* Admin Sidebar Fix for Mobile */
  #sidebar {
    min-height: auto !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }

  main {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .admin-header {
    padding: 2rem 1rem !important;
  }

  .stat-card {
    padding: 1.25rem !important;
  }
}

/* Ensure all tables are responsive by default */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Fix for overlapping elements and visibility in dark mode */
[data-theme="dark"] .shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.5) !important; }
[data-theme="dark"] .shadow { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.6) !important; }
[data-theme="dark"] .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.7) !important; }

/* Table visibility fix */
[data-theme="dark"] .table-responsive {
    background-color: transparent;
}

[data-theme="dark"] .modal-backdrop {
    opacity: 0.8;
}


/* ===== GLOBAL RESPONSIVE ADJUSTMENTS (Perfect Fit) ===== */

/* Global Hero/Header Section Fixes */
.hero-section, .about-hero, .catalog-header, .gallery-hero, .contact-hero, .profile-header, .admin-header, .checkout-header {
    padding-top: clamp(3rem, 8vh, 6rem) !important;
    padding-bottom: clamp(2rem, 6vh, 4rem) !important;
    min-height: auto !important;
}

/* Ensure images in hero sections are properly contained */
.hero-img, .hero-slide {
    background-position: center center !important;
}

/* Typography Scaling for Mobile */
@media (max-width: 576px) {
    .display-1 { font-size: clamp(2rem, 9vw, 3rem) !important; }
    .display-2 { font-size: clamp(1.8rem, 8vw, 2.8rem) !important; }
    .display-3 { font-size: clamp(1.6rem, 7vw, 2.4rem) !important; }
    .display-4 { font-size: clamp(1.4rem, 6vw, 2rem) !important; }
    
    h1 { font-size: clamp(1.6rem, 8vw, 2.2rem) !important; }
    h2 { font-size: clamp(1.4rem, 7vw, 2rem) !important; }
    h3 { font-size: clamp(1.2rem, 6vw, 1.6rem) !important; }
    
    .hero-title {
        font-size: clamp(1.8rem, 9vw, 3rem) !important;
        line-height: 1.1 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-subtitle, .lead, .fs-4-responsive {
        font-size: clamp(0.9rem, 4vw, 1.1rem) !important;
        line-height: 1.5 !important;
        margin-bottom: 1.5rem !important;
    }

    /* Buttons in Hero - Smarter behavior */
    .hero-btns, .contact-btns, .auth-btns {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
    }
    
    .hero-btns .btn, .contact-btns .btn, .auth-btns .btn {
        width: 100% !important;
    }

    /* Small utility buttons should NOT be 100% */
    .btn-sm, .btn-xs, .quantity-btn {
        width: auto !important;
    }

    /* Container Padding */
    .container {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }
}

/* Fix for index.ejs specific hero carousel height */
@media (max-width: 480px) {
    .hero-slide {
        height: 80vh !important;
        min-height: 400px !important;
    }
}

/* Catalog Header Custom Fix */
.catalog-header {
    background: var(--gradient-surface);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

/* Gallery Hero Custom Fix */
.gallery-hero {
    background: var(--gradient-primary) !important;
    color: white !important;
}

/* ===== PERFECT FIT FINAL POLISH ===== */

/* Force 1 column on ultra-small screens for plant cards if they look cramped */
@media (max-width: 380px) {
    .col-6, .col-sm-6 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Reduce section paddings on mobile to maximize content space */
@media (max-width: 768px) {
    section, .py-5 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Fix for any potential image overflow */
img {
    max-width: 100% !important;
    height: auto !important;
}

/* Fix for card bodies to prevent content overflow */
.card-body {
    overflow: hidden;
}

/* Ensure long text doesn't break layout */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Fix for horizontal scroll on mobile */
.main-content, main, body, html {
    position: relative;
    overflow-x: hidden !important;
}

/* Trust Bar Scaling */
@media (max-width: 576px) {
    .trust-item {
        font-size: 0.7rem !important;
        gap: 0.4rem !important;
    }
    .trust-item i {
        font-size: 0.85rem !important;
    }
}

/* Typography Scaling */
@media (max-width: 1199.98px) {
  .display-1 { font-size: 4rem; }
  .display-2 { font-size: 3.5rem; }
  .display-3 { font-size: 2.75rem; }
  .display-4 { font-size: 2.25rem; }
}

@media (max-width: 991.98px) {
  .display-1 { font-size: 3.5rem; }
  .display-2 { font-size: 3rem; }
  .display-3 { font-size: 2.5rem; }
  .display-4 { font-size: 2rem; }
  
  section { padding: 4rem 0 !important; }
  .admin-header { padding: 3rem 0 !important; }
}

@media (max-width: 767.98px) {
  .display-1 { font-size: 2.75rem !important; line-height: 1.1 !important; }
  .display-2 { font-size: 2.5rem !important; }
  .display-3 { font-size: 2.25rem !important; }
  .display-4 { font-size: 2rem !important; }
  
  h1 { font-size: 2.25rem !important; }
  h2 { font-size: 2rem !important; }
  h3 { font-size: 1.75rem !important; }
  
  p, .fs-5 { font-size: 1rem !important; }
  
  section { padding: 3rem 0 !important; }
  .container { padding-left: 20px !important; padding-right: 20px !important; }
  
  /* Prevent Overlaps in Flex Containers */
  .d-flex { flex-wrap: wrap; }
  .gap-4, .gap-5 { gap: 1rem !important; }
  
  /* Card Spacing */
  .card { margin-bottom: 1rem !important; }
  
  /* Navbar Overlap Fixes */
  .navbar-brand { font-size: 1.1rem !important; }
  .navbar-toggler { padding: 0.25rem 0.5rem !important; }
  
  /* Stat Cards in Admin */
  .stat-card { padding: 1.5rem !important; }
  .stat-number { font-size: 1.5rem !important; }
}

@media (max-width: 575.98px) {
  .display-1 { font-size: 2.25rem !important; }
  .display-2 { font-size: 2rem !important; }
  
  .btn-lg { padding: 0.75rem 1.5rem !important; font-size: 1rem !important; }
  
  /* Table Overlap Fix */
  .table-responsive {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    width: calc(100% + 40px);
  }
}

/* Hero content — flex-centered by parent, no absolute tricks needed */
.hero-content {
  width: 92% !important;
  max-width: 720px;
  position: relative !important;
  transform: none !important;
  left: auto !important;
  top: auto !important;
}

@media (max-width: 768px) {
  .hero-content {
    position: relative !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
    text-align: center !important;
    width: 95% !important;
    padding: 1rem 1rem 0 !important;
  }
  
  .hero-content .btn {
    width: auto !important;
    margin: 0 auto !important;
  }
}

/* Image Containment */
img.img-fluid {
  height: auto !important;
  max-width: 100% !important;
}

/* Fix for Bootstrap Gutter issues on small screens */
.row {
  margin-left: -10px;
  margin-right: -10px;
}
.row > [class*="col-"] {
  padding-left: 10px;
  padding-right: 10px;
}

/* Glassmorphism Consistency */
.glass {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Ensure no horizontal scroll */
body, html {
  overflow-x: hidden !important;
  width: 100%;
}

/* Fix for overlapping footer links */
.footer-link {
  display: inline-block;
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .footer .text-md-end {
    text-align: center !important;
    margin-top: 1.5rem;
  }
}

/* Brand Text Scaling */
@media (max-width: 575.98px) {
  .brand-title { font-size: 0.9rem !important; }
  .brand-subtitle { font-size: 0.6rem !important; }
}

/* Product Detail Utilities */
.product-image-container img {
  aspect-ratio: 1/1;
  width: 100%;
}

@media (max-width: 991px) {
  .product-image-container img {
    aspect-ratio: 4/3;
  }
}

/* Cart Item Responsive Layout */
@media (max-width: 768px) {
    .cart-item .row {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1rem !important;
    }
    .cart-item img {
        max-width: 120px !important;
        margin: 0 auto 0.5rem !important;
    }
    .quantity-controls {
        justify-content: center !important;
    }
}

/* Navbar Brand Fitting for super small screens */
@media (max-width: 360px) {
    .brand-title {
        font-size: 0.85rem !important;
        white-space: normal !important;
        line-height: 1.1 !important;
        max-width: 150px !important;
    }
    .navbar-brand {
        gap: 0.5rem !important;
    }
    .brand-subtitle {
        font-size: 0.55rem !important;
    }
}

/* Sticky Summary on mobile */
@media (max-width: 991px) {
    .checkout-card.sticky-top {
        position: static !important;
        margin-top: 2rem !important;
    }
}

.thumbnails-scroll::-webkit-scrollbar {
  height: 4px;
}
.thumbnails-scroll::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
}

/* Final Layout Overlap Guard */
.container {
  max-width: 100% !important;
}

@media (min-width: 1200px) {
  .container { max-width: 1140px !important; }
}

@media (min-width: 1400px) {
  .container { max-width: 1320px !important; }
}

/* ===== REUSABLE ADMIN UI COMPONENTS (Theme Aware) ===== */

/* Ensure the card can expand slightly if needed, but primarily truncate text */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: all var(--transition-base);
    height: 100%;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-width: 0; /* Critical for flexbox truncation */
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

[data-theme="dark"] .stat-icon {
    background: rgba(16, 185, 129, 0.2);
}

.stat-number {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table thead th {
    background-color: var(--background-alt);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 2px solid var(--border-light);
}

.table tbody td {
    vertical-align: middle;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-body);
}

.btn-action {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all var(--transition-base);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
}

.btn-action:hover {
    background: var(--background-alt);
    border-color: var(--text-light);
    color: var(--text-main);
    transform: translateY(-2px);
}

.btn-action i {
    font-size: 0.9rem;
}

.form-control, .form-select {
  font-size: 1rem;
  transition: all 0.3s ease;
  min-height: 44px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.form-control:focus, .form-select:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  outline: none;
}

.form-control.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.btn-action, .btn-action-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-action i, .btn-action-icon i {
    font-size: 0.8rem !important;
}

/* ===== CARD IMPROVEMENTS ===== */

/* ===== COMPACT ADMIN MODE (Enhanced Professional Look) ===== */
.stat-card {
    padding: 1.25rem !important;
}

.stat-icon {
    width: 42px !important;
    height: 42px !important;
    border-radius: 10px !important;
    font-size: 1.1rem !important;
    margin-bottom: 0.75rem !important;
}

.stat-number {
    font-size: 1.35rem !important;
}

.table thead th {
    padding: 0.75rem 1rem !important;
    font-size: 0.65rem !important;
}

.table tbody td {
    padding: 0.75rem 1rem !important;
    font-size: 0.85rem !important;
}

.btn-action {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
}

.btn-action i {
    font-size: 0.8rem !important;
}

.admin-header {
    padding: 3.5rem 0 !important;
}

.admin-page-header {
    padding: 3rem 0 !important;
}

.card-header {
    padding: 0.75rem 1.25rem !important;
}

.card-body {
    padding: 1.25rem !important;
}

/* Fix for mobile review rating (Horizontal Stars) */
.rating-input {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
}

@media (max-width: 576px) {
    .rating-star {
        font-size: 1.5rem !important;
        margin-right: 2px !important;
    }
}

.card {
  border-radius: 12px !important;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.admin-header .btn, .admin-page-header .btn {
    padding: 0.5rem 1.25rem !important;
    font-size: 0.85rem !important;
    min-height: 38px !important;
}

.admin-header .btn i, .admin-page-header .btn i {
    font-size: 0.75rem !important;
}

[data-theme="dark"] .table-responsive {
    border-color: var(--border-light);
}

.card-header {
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 1.5rem;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 1.5rem;
}

/* ===== TABLE IMPROVEMENTS ===== */

.table {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table thead th {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 2px solid #e2e8f0;
  color: #1e293b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem;
  font-size: 0.875rem;
}

.table tbody td {
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
  background: #f8fafc;
}

/* ===== NAVIGATION IMPROVEMENTS ===== */

.navbar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: #10b981;
}

.nav-link {
  font-weight: 600;
  color: #64748b;
  transition: all 0.3s ease;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin: 0 0.25rem;
}

.nav-link:hover {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.nav-link.active {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

/* ===== SIDEBAR IMPROVEMENTS ===== */

.sidebar {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.sidebar .nav-link {
  color: #64748b;
  padding: 0.75rem 1rem;
  margin: 0.25rem 0;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
  background: #10b981;
  color: white;
  transform: translateX(4px);
}

.sidebar .nav-link.active {
  background: #10b981;
  color: white;
}

/* ===== ADMIN HEADER IMPROVEMENTS ===== */

.admin-header {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  padding: 3rem 2rem;
  border-radius: 0 0 24px 24px;
  position: relative;
  overflow: hidden;
}

.admin-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="adminPattern" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="2" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23adminPattern)"/></svg>');
  opacity: 0.3;
}

.admin-header h1 {
  font-weight: 800;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.admin-header p {
  font-size: 1.125rem;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

/* ===== BADGE IMPROVEMENTS ===== */

.badge {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  letter-spacing: 0.025em;
}

.badge.bg-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.badge.bg-warning {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
}

.badge.bg-danger {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.badge.bg-info {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
}

/* ===== ALERT IMPROVEMENTS ===== */

.alert {
  border-radius: 12px;
  border: none;
  padding: 1rem 1.5rem;
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.alert-success {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #166534;
  border-left: 4px solid #10b981;
}

.alert-danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.alert-info {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #075985;
  border-left: 4px solid #06b6d4;
}

/* ===== MODAL IMPROVEMENTS ===== */

.modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
}

.modal-header {
  border-bottom: 1px solid #e2e8f0;
  padding: 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid #e2e8f0;
  padding: 1.5rem;
}

/* ===== DROPDOWN IMPROVEMENTS ===== */

.dropdown-menu {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
  font-weight: 500;
}

.dropdown-item:hover {
  background: #f8fafc;
  color: #10b981;
}

.dropdown-item.active {
  background: #10b981;
  color: white;
}

/* ===== PAGINATION IMPROVEMENTS ===== */

.pagination .page-link {
  border-radius: 8px;
  margin: 0 0.25rem;
  border: 2px solid #e2e8f0;
  color: #64748b;
  font-weight: 600;
  transition: all 0.3s ease;
}

.pagination .page-link:hover {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.pagination .page-item.active .page-link {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

/* ===== PROGRESS BAR IMPROVEMENTS ===== */

.progress {
  height: 8px;
  border-radius: 4px;
  background: #f1f5f9;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ===== ACCORDION IMPROVEMENTS ===== */

.accordion-button {
  border-radius: 8px;
  font-weight: 600;
  color: #1e293b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.accordion-button:not(.collapsed) {
  background: #10b981;
  color: white;
}

.accordion-button:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.accordion-item {
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: none;
}

/* ===== BREADCRUMB IMPROVEMENTS ===== */

.breadcrumb {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.breadcrumb-item {
  font-weight: 500;
  color: #64748b;
}

.breadcrumb-item.active {
  color: #10b981;
}

.breadcrumb-item a {
  color: #64748b;
  text-decoration: none;
  transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
  color: #10b981;
}

/* ===== FORM LAYOUT IMPROVEMENTS ===== */

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.form-text {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* ===== INPUT GROUP IMPROVEMENTS ===== */

.input-group {
  border-radius: 8px;
  overflow: hidden;
}

.input-group .form-control {
  border-radius: 0;
}

.input-group .form-control:first-child {
  border-radius: 8px 0 0 8px;
}

.input-group .form-control:last-child {
  border-radius: 0 8px 8px 0;
}

.input-group-text {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  color: #64748b;
  font-weight: 600;
}

/* ===== FLOATING LABEL IMPROVEMENTS ===== */

.form-floating {
  position: relative;
}

.form-floating label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  transition: all 0.3s ease;
  color: #64748b;
  font-weight: 500;
}

.form-floating .form-control:focus ~ label,
.form-floating .form-control:not(:placeholder-shown) ~ label {
  top: 0.5rem;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #10b981;
}

/* ===== CHECKBOX & RADIO IMPROVEMENTS ===== */

.form-check {
  margin-bottom: 1rem;
}

.form-check-input {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.form-check-input:checked {
  background: #10b981;
  border-color: #10b981;
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-check-label {
  font-weight: 500;
  color: #374151;
  margin-left: 0.5rem;
}

/* ===== RANGE SLIDER IMPROVEMENTS ===== */

.form-range {
  height: 8px;
  border-radius: 4px;
  background: #f1f5f9;
}

.form-range::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===== TOOLTIP IMPROVEMENTS ===== */

.tooltip {
  font-size: 0.875rem;
  font-weight: 500;
}

.tooltip .tooltip-inner {
  background: #1e293b;
  color: white;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}

/* ===== POPOVER IMPROVEMENTS ===== */

.popover {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.popover-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  color: #1e293b;
}

.popover-body {
  color: #64748b;
}

/* ===== SPINNER IMPROVEMENTS ===== */

.spinner-border {
  border-color: #10b981;
  border-right-color: transparent;
}

.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

.spinner-grow {
  background: #10b981;
}

/* ===== LIST GROUP IMPROVEMENTS ===== */

.list-group {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.list-group-item {
  border: none;
  border-bottom: 1px solid #f1f5f9;
  padding: 1rem;
  transition: all 0.3s ease;
}

.list-group-item:hover {
  background: #f8fafc;
}

.list-group-item:last-child {
  border-bottom: none;
}

.list-group-item.active {
  background: #10b981;
  color: white;
}

/* ===== UTILITIES ===== */

.text-gradient {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-soft {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.shadow-medium {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.shadow-strong {
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
}

.border-soft {
  border: 1px solid #e2e8f0;
}

.border-gradient {
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #059669 0%, #10b981 100%) border-box;
}

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* ===== RESPONSIVE OVERRIDES ===== */

@media (max-width: 768px) {
  .btn {
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
  }
  
  .btn-sm {
    min-height: 40px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .btn-lg {
    min-height: 56px;
    padding: 1rem 1.75rem;
    font-size: 1.125rem;
  }
  
  .form-control, .form-select {
    min-height: 48px;
    font-size: 1rem;
  }
  
  .admin-header {
    padding: 2rem 1rem;
  }
  
  .admin-header h1 {
    font-size: 2rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .table-responsive {
    font-size: 0.875rem;
  }
}

@media (max-width: 576px) {
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .btn-group {
    display: flex;
    flex-direction: column;
  }
  
  .btn-group .btn {
    border-radius: 8px;
    margin-bottom: 0.5rem;
  }
  
  .d-flex.gap-2 {
    flex-direction: column;
  }
  
  .d-flex.gap-3 {
    flex-direction: column;
  }
}

/* Improved toast responsiveness */
@media (max-width: 576px) {
  .toast-container {
    right: 10px !important;
    left: 10px !important;
    top: 10px !important;
    width: auto !important;
  }
  
  .toast {
    min-width: 0 !important;
    width: 100% !important;
    margin-right: 0 !important;
  }
}

.toast {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  color: var(--text-main);
  padding: 1rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin-bottom: 0.75rem;
  min-width: 300px;
  max-width: 500px;
  border-left: 5px solid var(--primary);
  animation: slideInRight 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow: hidden;
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.toast-message {
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.4;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.toast-close:hover {
  color: var(--text-main);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== PROFESSIONAL ICON POLISH ===== */

/* Smooth transition on all FontAwesome icons */
.fas, .fab, .far {
  transition: transform 0.25s ease, color 0.25s ease;
  display: inline-block;
}

/* Service card icons bounce on hover */
.service-card:hover .service-icon-wrap i {
  transform: scale(1.25) rotate(-8deg);
  color: var(--secondary, #d4af37);
}

/* Category card icons zoom on hover */
.cat-card:hover .cat-icon i {
  transform: scale(1.3);
}

/* Navbar icon nudge on hover */
.nav-link:hover i {
  transform: translateY(-2px);
}

/* Star ratings always show in gold */
.testi-stars .fa-star,
.fa-star.checked {
  color: #d4af37 !important;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* Theme toggle button */
.theme-toggle-btn {
  border: 1px solid var(--border, #e2e8f0) !important;
  border-radius: 50% !important;
  width: 40px;
  height: 40px;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #fff) !important;
  transition: all 0.3s ease !important;
}

.theme-toggle-btn:hover {
  background: var(--accent-light, #e8f5e9) !important;
  border-color: var(--accent, #1b5e20) !important;
  transform: rotate(20deg) scale(1.1);
}

.theme-toggle-btn i {
  font-size: 1.1rem;
  color: var(--accent, #1b5e20);
}

/* Preloader logo pulse */
.loader-logo img {
  animation: pulse-logo 1.5s ease-in-out infinite;
}

@keyframes pulse-logo {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.08); opacity: 0.85; }
}

/* Loader text */
.loader-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1b5e20;
  letter-spacing: 0.1em;
  margin-top: 0.5rem;
}
/* ===== ABOUT PAGE THEME OPTIMIZATIONS ===== */
[data-theme="dark"] .story-card,
[data-theme="dark"] .value-card,
[data-theme="dark"] .team-item,
[data-theme="dark"] .vision-card {
  background-color: var(--bg-card) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .stat-box .stat-num {
  color: var(--highlight) !important;
}

[data-theme="dark"] .accent-line {
  background: var(--highlight) !important;
}

[data-theme="dark"] .cta-premium {
  background: linear-gradient(135deg, #020617 0%, #064e3b 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .hero-tag {
  color: var(--highlight) !important;
}

/* ===== GOLDEN TOUCH POLISH ===== */

/* Premium Navbar Active State */
.nav-link.active {
    color: var(--accent) !important;
    background: rgba(16, 185, 129, 0.05);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 15%;
    width: 70%;
    height: 3px;
    background: var(--accent);
    border-radius: 10px;
    box-shadow: 0 0 10px var(--accent);
}

/* Enhanced Glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid var(--glass-border);
}

/* Alert Notification Polish */
.alert {
    border-radius: 16px;
    border: none !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 1.25rem 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    animation: slideInRight 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.alert-success { background: #064e3b !important; color: #ecfdf5 !important; }
.alert-danger { background: #7f1d1d !important; color: #fef2f2 !important; }

/* Global Link Hover Glow */
a:hover {
    text-shadow: 0 0 1px currentColor;
}

/* Premium Button Glow */
.btn-primary:hover, .btn-success:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4) !important;
}

/* Scroll Snap/Momentum */
html {
    scroll-padding-top: 80px;
}

/* Fix for overlapping admin badges */
.badge {
    padding: 0.4em 0.8em !important;
    font-weight: 700 !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--background) !important;
}

/* ===== COMPACT & ATTRACTIVE MOBILE NAVBAR (Offcanvas) ===== */

/* Compact Brand for Mobile */
@media (max-width: 575.98px) {
    .navbar-brand {
        padding: 0 !important;
    }
    .brand-title {
        font-size: 0.85rem !important;
        letter-spacing: -0.01em !important;
    }
    .brand-subtitle {
        font-size: 0.55rem !important;
    }
    .navbar-toggler {
        padding: 0.5rem !important;
        background: rgba(16, 185, 129, 0.05);
        border-radius: 10px;
    }
}

/* Offcanvas Custom Styling */
.offcanvas {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.offcanvas-header {
    background: var(--background-alt);
}

.offcanvas .list-group-item {
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.offcanvas .list-group-item:hover {
    padding-left: 2rem !important;
    background: rgba(16, 185, 129, 0.05);
    color: var(--accent);
}

.offcanvas .list-group-item.bg-primary-light {
    background: rgba(16, 185, 129, 0.1) !important;
    border-left: 4px solid var(--accent) !important;
}

/* Glassmorphism for Offcanvas Header */
.offcanvas-header {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] .offcanvas {
    background-color: #0c1a14 !important;
}

/* Desktop Nav Specifics (Handled by Bootstrap) */

/* ===== RESPONSIVE HERO & TEXT POSITIONING FIX ===== */
/*
 * The sticky navbar stays IN the document flow, so the hero carousel
 * starts BELOW the navbar — no need to subtract navbar height from hero height.
 * We DO need to add top padding inside the hero so the badge/title is
 * never clipped behind the navbar on very small or short screens.
 */

/* Desktop hero height — full viewport from the point it starts */
.hero-slide {
    height: 100svh !important;
    min-height: 580px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}

/* Fallback for browsers that don't support svh */
@supports not (height: 100svh) {
    .hero-slide {
        height: 100vh !important;
    }
}

.about-hero {
    min-height: 60vh !important;
    max-height: 85vh !important;
}

.contact-hero {
    min-height: 50vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 3rem 0 !important;
}

/* Hero content — let flexbox do the centering, no transform tricks */
.hero-content,
.contact-hero-content {
    margin: 0 auto !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 800px !important;
    z-index: 2 !important;
    position: relative !important;
    transform: none !important;
    padding: 0 1.5rem !important;
}

/* Make sure hero badge is always visible */
.hero-badge {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 1.2rem !important;
}

/* Fluid Typography for Hero Titles */
.hero-title,
.contact-hero h1 {
    font-size: clamp(2rem, 7vw, 5.5rem) !important;
    margin-bottom: 1rem !important;
    line-height: 1.08 !important;
}

.hero-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem) !important;
    margin-bottom: 1.8rem !important;
    line-height: 1.65 !important;
    max-width: 680px !important;
}

/* ── MOBILE hero fixes ─────────────────────────────────────── */
@media (max-width: 767.98px) {

    /* On mobile, hero starts below ~60px navbar.
       Use padding-top so flex-centering works in the VISIBLE area. */
    .hero-slide {
        height: 100svh !important;
        min-height: 560px !important;
        padding-top: 0 !important; /* navbar is in flow, not overlapping */
        box-sizing: border-box !important;
    }

    .hero-content,
    .contact-hero-content {
        padding: 0 1rem !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        transform: none !important;
        left: auto !important;
        top: auto !important;
    }

    .hero-title,
    .contact-hero h1 {
        font-size: clamp(1.9rem, 9vw, 2.8rem) !important;
        line-height: 1.1 !important;
        margin-bottom: 0.75rem !important;
    }

    .hero-subtitle {
        font-size: clamp(0.88rem, 4vw, 1rem) !important;
        margin-bottom: 1.5rem !important;
        max-width: 100% !important;
    }

    .hero-badge {
        font-size: 0.68rem !important;
        padding: 0.35rem 1rem !important;
        margin-bottom: 1rem !important;
    }

    .hero-btns {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.7rem !important;
        align-items: stretch !important;
    }

    .hero-btns .btn-hero-primary,
    .hero-btns .btn-hero-outline {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.85rem 1.5rem !important;
        font-size: 0.9rem !important;
    }
}

/* ===== ENHANCED GLOBAL THEME VISIBILITY FIXES ===== */

/* 1. Root variable consolidation for dark mode */
[data-theme="dark"] {
    /* Brand Colors - Optimized for dark backgrounds */
    --primary: #34d399;
    --primary-dark: #10b981;
    --primary-light: rgba(52, 211, 153, 0.15);
    --accent: #10b981;
    --accent-light: rgba(16, 185, 129, 0.2);
    
    /* Semantic Colors */
    --text-main: #f8fafc;
    --text-body: #e2e8f0;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    /* Backgrounds */
    --background: #0f172a;
    --background-alt: #1e293b;
    --surface: #1e293b;
    --border: #334155;
    --border-light: #1e293b;
    
    --highlight: #10b981;
    --bg-card: #1e293b;
}

/* 2. Global Utility Class Overrides for Dark Mode */
[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-black,
[data-theme="dark"] .text-secondary {
    color: var(--text-main) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--background-alt) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--surface) !important;
}

[data-theme="dark"] .border-light,
[data-theme="dark"] .border {
    border-color: var(--border) !important;
}

/* 3. Button Visibility Improvements */
[data-theme="dark"] .btn-light {
    background-color: var(--background-alt) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .btn-light:hover {
    background-color: var(--surface) !important;
    border-color: var(--accent) !important;
}

[data-theme="dark"] .btn-outline-dark {
    border-color: var(--text-muted) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .btn-outline-dark:hover {
    background-color: var(--text-muted) !important;
    color: var(--background) !important;
}

/* 4. Form and Input Visibility */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-light) !important;
    opacity: 0.7;
}

[data-theme="dark"] .form-control:focus {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1) !important;
}

/* 5. Card and Layout Polish */
[data-theme="dark"] .card {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .card-header {
    background-color: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid var(--border) !important;
}

[data-theme="dark"] .list-group-item {
    background-color: transparent !important;
    border-color: var(--border) !important;
    color: var(--text-body) !important;
}

[data-theme="dark"] .list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

/* 6. Navbar Theme Polish */
[data-theme="dark"] .navbar {
    background-color: rgba(15, 23, 42, 0.9) !important;
}

[data-theme="dark"] .navbar.scrolled {
    background-color: rgba(15, 23, 42, 0.98) !important;
    border-bottom: 1px solid var(--border) !important;
}

[data-theme="dark"] .nav-link {
    color: var(--text-body) !important;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
    color: var(--accent) !important;
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--surface) !important;
    border: 1px solid var(--border) !important;
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-body) !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--background-alt) !important;
    color: var(--text-main) !important;
}

/* 7. Badge and Alert Visibility */
[data-theme="dark"] .badge.bg-primary {
    background-color: var(--accent) !important;
    color: white !important;
}

[data-theme="dark"] .badge.bg-success {
    background-color: #059669 !important;
    color: white !important;
}

[data-theme="dark"] .alert-success {
    background-color: #064e3b !important;
    color: #ecfdf5 !important;
    border: 1px solid rgba(16, 185, 129, 0.2) !important;
}

[data-theme="dark"] .alert-danger {
    background-color: #7f1d1d !important;
    color: #fef2f2 !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}
