* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #047857;
  --primary-dark: #065f46;
  --primary-light: #10b981;
  --highlight: #e7f9f4;
  --neutral-50: #fafafa;
  --neutral-100: #f3f4f6;
  --neutral-200: #e5e7eb;
  --neutral-400: #9ca3af;
  --neutral-600: #4b5563;
  --neutral-700: #374151;
  --neutral-900: #111827;
  --danger: #dc2626;
  --success: #16a34a;
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  color: var(--neutral-900);
  background-color: var(--neutral-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Icon Utilities */
.bi {
  display: inline-block;
  vertical-align: -0.125em;
  /* Standard alignment for icons next to text */
  fill: currentColor;
}

[class^="bi-"]::before,
[class*=" bi-"]::before {
  display: inline-block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== ENHANCED RESPONSIVE HEADER ===== */
.sticky-header {
  position: sticky;
  top: 0;
  background-color: white;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  padding: 1rem 0;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  position: relative;
}

.logo a {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  z-index: 1001;
}

/* Hamburger Menu Button */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.mobile-menu-toggle span {
  width: 25px;
  height: 3px;
  background-color: var(--primary);
  transition: all 0.3s ease;
  border-radius: 3px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Main Navigation */
.main-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
  flex: 1;
}

.main-nav a {
  color: var(--neutral-600);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
}

.main-nav a::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.main-nav a:hover {
  color: var(--primary);
}

.main-nav a:hover::after {
  width: 100%;
}

/* Dropdown Navigation */
.nav-dropdown {
  position: relative;
}

.nav-toggle {
  background: none;
  border: none;
  color: var(--neutral-600);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-toggle::after {
  content: "▼";
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.nav-dropdown:hover .nav-toggle::after {
  transform: rotate(180deg);
}

.nav-toggle:hover {
  color: var(--primary);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  display: none;
  min-width: 200px;
  margin-top: 0.5rem;
  animation: slideDown 0.3s ease-out;
}

.nav-dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--neutral-600);
  text-decoration: none;
  transition: background-color 0.2s;
}

.dropdown-menu a::after {
  display: none;
}

.dropdown-menu a:hover {
  background-color: var(--highlight);
  color: var(--primary);
}

/* User Menu */
.user-menu {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

/* User Dropdown System */
.user-dropdown {
  position: relative;
  display: inline-block;
}

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid var(--neutral-200);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  color: var(--neutral-700);
}

.user-dropdown-toggle:hover {
  border-color: var(--primary);
  background: var(--neutral-50);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.user-dropdown-toggle i:first-child {
  font-size: 1.25rem;
  color: var(--primary);
}

.user-name-text {
  font-weight: 600;
  font-size: 0.95rem;
}

.toggle-icon {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.user-dropdown.active .toggle-icon {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  width: 240px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--neutral-100);
  padding: 0.5rem;
  display: none;
  z-index: 1000;
  animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-dropdown.active .user-dropdown-menu {
  display: block;
}

.dropdown-header {
  padding: 0.75rem 1rem;
}

.user-role {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  margin-bottom: 0.25rem;
}

.user-email {
  font-size: 0.85rem;
  color: var(--neutral-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-divider {
  height: 1px;
  background: var(--neutral-100);
  margin: 0.5rem 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--neutral-700);
  text-decoration: none;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background: var(--neutral-50);
  color: var(--primary);
}

.dropdown-item i {
  font-size: 1.1rem;
  opacity: 0.7;
}

.logout-item:hover {
  background: #fee2e2;
  color: #dc2626;
}

.guest-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ===== MOBILE RESPONSIVE HEADER ===== */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .header-container {
    padding: 0 1rem;
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: white;
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 2rem 2rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
    gap: 0;
  }

  .main-nav.active {
    right: 0;
  }

  .main-nav a {
    width: 100%;
    padding: 1rem 0;
    border-bottom: 1px solid var(--neutral-100);
  }

  .nav-dropdown {
    width: 100%;
  }

  .nav-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--neutral-100);
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    margin: 0;
    padding-left: 1rem;
    background: var(--neutral-50);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-dropdown.active .dropdown-menu {
    display: block;
    max-height: 500px;
  }

  .user-menu {
    position: fixed;
    bottom: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    background: white;
    padding: 1.5rem;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: -2px -2px 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    border-top: 2px solid var(--primary);
  }

  .user-menu.active {
    right: 0;
  }

  .user-menu a,
  .user-menu button {
    width: 100%;
    text-align: center;
  }

  /* Mobile User Dropdown Overrides */
  .user-dropdown {
    width: 100%;
  }

  .user-dropdown-toggle {
    width: 100%;
    justify-content: center;
    border-radius: 8px;
  }

  .user-dropdown-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--neutral-100);
    margin-top: 0.5rem;
    padding: 0;
    display: none;
    background: var(--neutral-50);
  }

  .user-dropdown.active .user-dropdown-menu {
    display: block;
  }

  .dropdown-item {
    justify-content: center;
    border-radius: 0;
    border-bottom: 1px solid var(--neutral-100);
  }

  .dropdown-header {
    text-align: center;
  }

  /* Mobile overlay */
  .mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-overlay.active {
    display: block;
    opacity: 1;
  }
}

/* ===== BUTTONS ===== */
.btn-primary,
.btn-secondary,
.btn-logout,
.btn-admin {
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  border: none;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  font-family: inherit;
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.3);
}

.btn-secondary {
  background-color: var(--neutral-100);
  color: var(--neutral-900);
}

.btn-secondary:hover {
  background-color: var(--neutral-200);
  transform: translateY(-2px);
}

.btn-admin {
  background-color: var(--primary-light);
  color: white;
}

.btn-logout {
  background-color: var(--danger);
  color: white;
}

.btn-logout:hover {
  background-color: #b91c1c;
}

/* ===== MAIN CONTENT ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
}

.page-title {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 3rem;
  color: var(--neutral-900);
  text-align: center;
  position: relative;
  padding-bottom: 1rem;
}

.page-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background-color: var(--danger);
}

.breadcrumb {
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--neutral-600);
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ===== ENHANCED RESPONSIVE GRID ===== */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .grid-cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .grid {
    gap: 1rem;
  }

  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* ===== RECENTLY ADDED CARDS (HOMEPAGE) ===== */
.recent-card {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid var(--neutral-200);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  align-items: flex-start;
}

.recent-card:hover {
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--primary-light);
  transform: translateY(-4px) scale(1.01);
  background: white;
}

.recent-card-icon-box {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* Soft generic background if --icon-color is not provided */
  background: var(--neutral-50); 
}

/* If inline variable is used */
.recent-card-icon-box[style*="--icon-color"] {
  background: color-mix(in srgb, var(--icon-color) 10%, transparent);
}

.recent-card-icon-box img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.recent-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.recent-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--neutral-900);
  margin-bottom: 0.5rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.recent-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.recent-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.recent-badge-category {
  background: #e6f6f2;
  color: var(--primary-dark);
}

.recent-badge-tag {
  background: var(--neutral-100);
  color: var(--neutral-700);
}

.recent-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.recent-card-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.recent-card-meta {
  display: flex;
  gap: 1rem;
  color: var(--neutral-600);
  font-size: 0.8rem;
  font-weight: 500;
}

.recent-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 640px) {
  .recent-card {
    flex-direction: column;
    gap: 1rem;
  }
  .recent-card-icon-box {
    width: 48px;
    height: 48px;
  }
}

/* ===== ENHANCED CARDS FOR BROWSE.PHP ===== */
.card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
}

.card:hover::before {
  transform: scaleX(1);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--neutral-900);
  line-height: 1.4;
}

.card-description {
  color: var(--neutral-600);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  flex-grow: 1;
  line-height: 1.5;
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.card-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.card img {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
}

/* ===== PREMIUM HOMEPAGE ENHANCEMENTS ===== */
.premium-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #e7f9f4 100%);
    position: relative;
    overflow: hidden;
    padding: 3rem 2rem;
    border-radius: 12px;
}

.premium-section::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23047857' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.premium-card {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.premium-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    background: white !important;
}

.glass-badge {
    background: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.icon-container-premium {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 1.25rem;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
}

.premium-card:hover .icon-container-premium {
    transform: scale(1.05);
    background: white;
    box-shadow: 0 12px 20px rgba(4, 120, 87, 0.12);
}

.btn-premium {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    border: none !important;
    color: white !important;
    padding: 0.85rem 1rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.3) !important;
    transition: all 0.3s ease !important;
    text-align: center;
    text-decoration: none;
    margin-top: auto;
}

.btn-premium:hover {
    box-shadow: 0 8px 25px rgba(4, 120, 87, 0.45) !important;
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Mobile card adjustments */
@media (max-width: 480px) {
  .card {
    padding: 1rem;
  }

  .card-title {
    font-size: 1rem;
  }

  .card-description {
    font-size: 0.8rem;
  }

  .card-price {
    font-size: 1.1rem;
  }
}

/* ===== FORMS ===== */
form {
  background: white;
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--neutral-900);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--neutral-200);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--highlight);
}

textarea {
  resize: vertical;
  min-height: 150px;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

@media (max-width: 480px) {
  form {
    padding: 1.5rem 1rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions button,
  .form-actions a {
    width: 100%;
  }
}

/* ===== ENHANCED RESPONSIVE FOOTER ===== */
.site-footer {
  background-color: var(--neutral-900);
  color: var(--neutral-100);
  padding: 3rem 2rem 1rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  margin-bottom: 1rem;
  color: white;
  font-size: 1.1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section a {
  color: var(--neutral-100);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
  transition: color 0.2s;
  font-size: 0.9rem;
}

.footer-section a:hover {
  color: var(--primary-light);
  padding-left: 5px;
}

.newsletter-form {
  display: flex;
  gap: 0.5rem;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.newsletter-form input {
  flex: 1;
  background: var(--neutral-800);
  border: 1px solid var(--neutral-700);
  color: white;
}

.newsletter-form button {
  white-space: nowrap;
}

.footer-bottom {
  max-width: 1280px;
  margin: 0 auto;
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid var(--neutral-700);
  color: var(--neutral-400);
  font-size: 0.875rem;
}

/* Mobile Footer Responsive */
@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .footer-section h4 {
    font-size: 1rem;
  }

  .footer-section a {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .site-footer {
    padding: 2rem 1rem 1rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-section {
    text-align: center;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-form button {
    width: 100%;
  }
}

/* ===== TABLES ===== */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: var(--shadow-sm);
  border-radius: var(--border-radius);
  overflow: hidden;
}

th {
  background-color: var(--highlight);
  color: var(--primary);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--neutral-200);
}

tr:hover {
  background-color: var(--neutral-50);
}

/* Mobile table */
@media (max-width: 768px) {
  table {
    font-size: 0.875rem;
  }

  th,
  td {
    padding: 0.75rem 0.5rem;
  }
}

@media (max-width: 480px) {

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    margin-bottom: 1rem;
    border: 1px solid var(--neutral-200);
    border-radius: var(--border-radius);
  }

  td {
    border: none;
    position: relative;
    padding-left: 50%;
    text-align: right;
  }

  td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.75rem;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    font-weight: 600;
    text-align: left;
  }
}

/* ===== ALERTS ===== */
.alert {
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  animation: slideInDown 0.4s ease-out;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--success);
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--danger);
}

.alert-info {
  background-color: var(--highlight);
  color: var(--primary);
  border-left: 4px solid var(--primary);
}

/* ===== HERO SECTION ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 4rem 2rem;
  border-radius: var(--border-radius);
  margin-bottom: 3rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.125rem;
  margin-bottom: 2rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  .hero {
    padding: 2.5rem 1.5rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 2rem 1rem;
    border-radius: 0;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 0.9rem;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section {
  animation: fadeInUp 0.6s ease-out;
}

/* ===== UTILITY CLASSES ===== */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.hidden {
  display: none;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }
}

@media (min-width: 769px) {
  .show-mobile {
    display: none;
  }
}

/* Add these mobile-specific fixes to your style.css file */

/* ===== MOBILE OVERFLOW FIXES ===== */

/* Prevent horizontal scroll on all devices */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Make all containers respect viewport width */
.container,
section,
.footer-content {
  max-width: 100%;
  overflow-x: hidden;
}

/* ===== HERO SECTION MOBILE FIXES ===== */
@media (max-width: 768px) {
  .hero {
    padding: 2.5rem 1rem !important;
    overflow: hidden;
  }

  .hero h1 {
    font-size: 1.75rem !important;
    line-height: 1.3 !important;
    padding: 0 0.5rem;
  }

  .hero p {
    font-size: 1rem !important;
    padding: 0 0.5rem;
  }

  /* Fix the floating decoration element */
  .hero>div[style*="position: absolute"] {
    width: 200px !important;
    height: 200px !important;
    right: -20% !important;
  }

  /* Fix hero buttons container */
  .hero div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 0 0.5rem;
  }

  .hero .btn-primary,
  .hero .btn-secondary {
    width: 100% !important;
    max-width: 100%;
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem !important;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 2rem 0.75rem !important;
    margin-left: -2rem;
    margin-right: -2rem;
    border-radius: 0 !important;
  }

  .hero h1 {
    font-size: 1.5rem !important;
  }

  .hero p {
    font-size: 0.9rem !important;
  }
}

/* ===== HOW IT WORKS SECTION MOBILE FIXES ===== */
@media (max-width: 768px) {

  /* Make 4-column grid into 2 columns on tablets */
  section div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }

  /* Make 3-column "Why Choose" grid into single column */
  section div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
}

@media (max-width: 480px) {

  /* Stack all steps vertically on mobile */
  section div[style*="grid-template-columns: repeat(4, 1fr)"],
  section div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* Adjust step icons */
  section div[style*="width: 80px; height: 80px"] {
    width: 60px !important;
    height: 60px !important;
    font-size: 1.5rem !important;
  }
}

/* ===== NEWSLETTER SECTION MOBILE FIXES ===== */
@media (max-width: 768px) {

  /* Make newsletter form stack vertically */
  form[action="/api/subscribe-newsletter.php"] {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  form[action="/api/subscribe-newsletter.php"] input,
  form[action="/api/subscribe-newsletter.php"] button {
    width: 100% !important;
  }

  /* Fix newsletter container padding */
  section.container>div[style*="background: linear-gradient"] {
    padding: 2rem 1rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  section.container>div[style*="background: linear-gradient"] h2 {
    font-size: 1.5rem !important;
  }

  section.container>div[style*="background: linear-gradient"] p {
    font-size: 1rem !important;
    padding: 0 0.5rem;
  }
}

/* ===== POPULAR DOWNLOADS SECTION MOBILE FIXES ===== */
@media (max-width: 768px) {

  /* Fix background section */
  section[style*="background: #f0fdf4"] {
    padding: 2rem 1rem !important;
    margin-left: -1rem !important;
    margin-right: -1rem !important;
  }
}

/* ===== RECENT UPLOADS CARD FIXES ===== */
@media (max-width: 768px) {

  /* Fix recent docs cards that have flex layout */
  .card[style*="display: flex"] {
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .card[style*="display: flex"]>div[style*="width: 120px"] {
    width: 100% !important;
    height: 120px !important;
    margin: 0 auto;
  }
}

/* ===== GENERAL MOBILE SPACING FIXES ===== */
@media (max-width: 480px) {

  /* Reduce container padding on very small screens */
  .container {
    padding: 1rem 0.75rem !important;
  }

  /* Fix section margins */
  section.container {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Fix any remaining grid issues */
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* Ensure all text respects viewport */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

/* ===== CARD ICON/IMAGE FIXES ===== */
@media (max-width: 480px) {
  .card img[style*="width: 80px"] {
    width: 60px !important;
    height: 60px !important;
  }
}

/* ===== ENSURE NO ELEMENT CAUSES OVERFLOW ===== */
* {
  max-width: 100%;
}

img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* Prevent any absolute positioned elements from causing overflow */
@media (max-width: 768px) {
  *[style*="position: absolute"] {
    max-width: calc(100vw - 2rem);
  }
}

/* ===== ITEM.PHP MOBILE RESPONSIVE FIXES ===== */

/* Desktop: 2-column layout (content + sidebar) */
.item-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

/* Mobile: Stack vertically, sidebar first for better UX */
@media (max-width: 992px) {
  .item-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Move sidebar (purchase card) to top on mobile */
  .item-layout aside {
    order: -1;
  }

  .item-layout section {
    order: 1;
  }
}

/* ===== ITEM PAGE STICKY SIDEBAR FIX ===== */
@media (max-width: 992px) {

  /* Remove sticky positioning on mobile */
  aside>div[style*="position: sticky"] {
    position: relative !important;
    top: auto !important;
  }
}

/* ===== ITEM DETAILS TABLE RESPONSIVE ===== */
@media (max-width: 768px) {

  /* Make document details table more readable */
  .item-details-table table {
    font-size: 0.9rem;
  }

  .item-details-table td {
    padding: 0.75rem 0.5rem !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .item-details-table td:first-child {
    width: 40%;
    font-weight: 600;
  }

  .item-details-table td:last-child {
    width: 60%;
  }
}

@media (max-width: 480px) {

  /* Stack table rows more tightly on very small screens */
  .item-details-table table {
    font-size: 0.85rem;
  }

  .item-details-table td {
    padding: 0.6rem 0.25rem !important;
    display: block;
    width: 100% !important;
    border-bottom: 1px solid var(--neutral-200);
  }

  .item-details-table tr {
    display: block;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--neutral-300);
  }

  .item-details-table td:first-child {
    padding-bottom: 0.25rem !important;
    color: var(--neutral-600);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .item-details-table td:last-child {
    padding-top: 0.25rem !important;
    font-weight: 600;
    color: var(--neutral-900);
  }
}

/* ===== PURCHASE CARD MOBILE FIXES ===== */
@media (max-width: 768px) {

  /* Make purchase card full width with better spacing */
  aside>div {
    padding: 1.5rem 1rem !important;
    margin-bottom: 1.5rem;
  }

  /* Adjust price display */
  .card-price {
    font-size: 1.75rem !important;
    margin-bottom: 1rem !important;
  }

  /* Make buttons more touch-friendly */
  aside button,
  aside a.btn-primary {
    padding: 1rem !important;
    font-size: 1rem !important;
    min-height: 48px;
    /* Better touch target */
  }

  /* Guest email input */
  #guest-email {
    padding: 0.875rem !important;
    font-size: 1rem !important;
    min-height: 48px;
  }
}

/* ===== BREADCRUMB MOBILE FIX ===== */
@media (max-width: 768px) {
  .breadcrumb {
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .breadcrumb::-webkit-scrollbar {
    height: 4px;
  }

  .breadcrumb::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 2px;
  }
}

/* ===== PAGE TITLE MOBILE ===== */
@media (max-width: 768px) {
  .page-title {
    font-size: 1.5rem !important;
    line-height: 1.3;
    margin-bottom: 1.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.25rem !important;
  }
}

/* ===== DOCUMENT DETAILS SECTION MOBILE ===== */
@media (max-width: 768px) {

  /* Reduce padding in white boxes */
  section>div[style*="background: white"] {
    padding: 1.5rem 1rem !important;
    margin-bottom: 1.5rem !important;
  }

  section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  /* Description text */
  section p {
    font-size: 0.9rem;
    line-height: 1.6;
  }
}

@media (max-width: 480px) {
  section>div[style*="background: white"] {
    padding: 1.25rem 0.75rem !important;
    border-radius: 6px !important;
  }

  section h3 {
    font-size: 1rem;
  }
}

/* ===== GUEST PURCHASE FORM MOBILE ===== */
@media (max-width: 768px) {
  #guest-purchase-form p {
    font-size: 0.85rem !important;
    margin-bottom: 0.75rem !important;
    padding: 0 0.25rem;
  }

  #guest-purchase-form small {
    font-size: 0.75rem !important;
  }
}

/* ===== SECURE PAYMENT BADGE ===== */
@media (max-width: 768px) {
  aside small {
    font-size: 0.8rem !important;
    padding: 0 0.5rem;
  }
}

/* ===== CONTAINER MOBILE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  main.container {
    padding: 1.5rem 1rem !important;
  }
}

@media (max-width: 480px) {
  main.container {
    padding: 1rem 0.75rem !important;
  }
}

/* ===== ENHANCED TOUCH TARGETS FOR MOBILE ===== */
@media (max-width: 768px) {

  /* All clickable elements should be at least 44x44px for accessibility */
  button,
  a.btn-primary,
  a.btn-secondary,
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Links in text should have more padding */
  a {
    padding: 0.25rem 0;
    display: inline-block;
  }
}

/* ===== PREVENT HORIZONTAL OVERFLOW ===== */
@media (max-width: 768px) {

  /* Ensure nothing causes horizontal scroll */
  main.container>div,
  section,
  aside,
  table {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Long text should break properly */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  td,
  th {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

/* ===== LOADING STATES (BONUS) ===== */
@media (max-width: 768px) {

  /* When Paystack popup opens, prevent body scroll */
  body.paystack-open {
    overflow: hidden;
  }

  /* Add visual feedback for button clicks */
  button:active,
  a.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
}

/* ===== PRINT STYLES (BONUS) ===== */
@media print {
  aside {
    display: none !important;
  }

  main.container>div {
    grid-template-columns: 1fr !important;
  }
}

/* ===== CRITICAL FIX FOR TABLE LAYOUT ON MOBILE ===== */

/* Force table to be 100% width and remove any extra spacing */
@media (max-width: 768px) {

  /* Remove table structure completely on mobile */
  .item-details-table table,
  .item-details-table tbody,
  .item-details-table tr,
  .item-details-table td {
    display: block !important;
    width: 100% !important;
  }

  /* Reset all table elements */
  .item-details-table table {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Style each row as a card-like item */
  .item-details-table tr {
    margin-bottom: 1rem !important;
    padding: 0.75rem !important;
    background: var(--neutral-50) !important;
    border-radius: 6px !important;
    border: 1px solid var(--neutral-200) !important;
  }

  /* First cell (label) */
  .item-details-table td:first-child {
    display: block !important;
    width: 100% !important;
    padding: 0 0 0.25rem 0 !important;
    border: none !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: var(--neutral-600) !important;
    font-weight: 600 !important;
  }

  /* Second cell (value) */
  .item-details-table td:last-child {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.95rem !important;
    color: var(--neutral-900) !important;
    font-weight: 500 !important;
  }

  /* Remove strong tags from labels on mobile */
  .item-details-table td:first-child strong {
    font-weight: inherit;
  }
}

/* ===== ENSURE NO OVERFLOW ON CONTAINER ===== */
@media (max-width: 768px) {

  /* Force all containers to respect viewport */
  .item-details-table,
  .item-details-table>div,
  section>div {
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /* Reduce padding to prevent overflow */
  section>div[style*="background: white"] {
    padding: 1rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Fix page title word break */
  .page-title {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
  }
}

/* ===== ALTERNATIVE: DEFINITION LIST STYLE (RECOMMENDED) ===== */
@media (max-width: 768px) {

  /* Style for better mobile presentation */
  .item-details-table tr {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.25rem !important;
    padding: 0.875rem 1rem !important;
    margin-bottom: 0.75rem !important;
    background: linear-gradient(135deg, var(--neutral-50) 0%, white 100%) !important;
    border-left: 3px solid var(--primary-light) !important;
  }

  /* Badge style for values with background */
  .item-details-table td:last-child span[style*="background"] {
    display: inline-block !important;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.85rem !important;
  }
}

/* ===== FIX SPECIFIC MOBILE VIEWPORT ISSUES ===== */
@media (max-width: 480px) {

  /* Ensure container respects mobile viewport */
  main.container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Reduce all card padding */
  .item-details-table>div,
  section>div[style*="background: white"] {
    padding: 0.875rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Make table rows more compact */
  .item-details-table tr {
    padding: 0.75rem 0.875rem !important;
    margin-bottom: 0.625rem !important;
  }

  /* Smaller text on very small screens */
  .item-details-table td:first-child {
    font-size: 0.7rem !important;
  }

  .item-details-table td:last-child {
    font-size: 0.875rem !important;
  }
}

/* ===== GLOBAL MOBILE OVERFLOW PREVENTION ===== */
@media (max-width: 768px) {

  /* Nuclear option: prevent any horizontal scroll */
  html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    position: relative !important;
  }

  * {
    max-width: 100% !important;
  }

  /* Except for these elements that need specific widths */
  button,
  input,
  select,
  textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* ===== BREADCRUMB FIX FOR LONG TEXT ===== */
@media (max-width: 768px) {
  .breadcrumb {
    font-size: 0.75rem !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
  }

  .breadcrumb::-webkit-scrollbar {
    height: 3px !important;
  }

  .breadcrumb::-webkit-scrollbar-thumb {
    background: var(--neutral-300) !important;
    border-radius: 3px !important;
  }
}

/* ========================================
   COMPLETE MOBILE RESPONSIVE FIX
   Add this entire section to the END of your style.css
   ======================================== */

/* ===== GLOBAL MOBILE OVERFLOW PREVENTION ===== */
@media (max-width: 768px) {

  html,
  body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  * {
    box-sizing: border-box !important;
  }
}

/* ===== HERO SECTION MOBILE FIX ===== */
@media (max-width: 768px) {
  .hero {
    padding: 0 !important;
    margin-bottom: 2rem;
  }

  .hero .container {
    padding: 2.5rem 1rem !important;
  }

  .hero h1 {
    font-size: 1.75rem !important;
    line-height: 1.3 !important;
    margin-bottom: 1rem !important;
  }

  .hero p {
    font-size: 1rem !important;
    margin-bottom: 1.5rem !important;
  }

  /* Floating decoration */
  .hero>div[style*="position: absolute"] {
    width: 200px !important;
    height: 200px !important;
    right: -15% !important;
    opacity: 0.3 !important;
  }

  /* Button container */
  .hero .container>div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Buttons */
  .hero a.btn-primary,
  .hero a.btn-secondary {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.875rem 1.5rem !important;
    font-size: 1rem !important;
    display: block !important;
    text-align: center !important;
  }
}

@media (max-width: 480px) {
  .hero .container {
    padding: 2rem 0.75rem !important;
  }

  .hero h1 {
    font-size: 1.5rem !important;
  }

  .hero p {
    font-size: 0.9rem !important;
  }
}

/* ===== BROWSE BY CATEGORY SECTION ===== */
@media (max-width: 768px) {
  section.container>.grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
  }

  section.container>.grid>a.card {
    padding: 1.25rem 1rem !important;
  }

  section.container>.grid>a.card img {
    width: 60px !important;
    height: 60px !important;
  }

  section.container>.grid>a.card h3 {
    font-size: 0.95rem !important;
  }

  section.container>.grid>a.card p {
    font-size: 0.8rem !important;
  }
}

@media (max-width: 480px) {
  section.container>.grid {
    grid-template-columns: 1fr !important;
  }
}

/* ===== POPULAR DOWNLOADS & SECTIONS WITH BACKGROUNDS ===== */
@media (max-width: 768px) {

  section[style*="background: #f0fdf4"],
  section[style*="background: linear-gradient"] {
    padding: 2rem 1rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 8px !important;
  }

  section[style*="background: #f0fdf4"] .grid,
  section .grid-cols-3,
  section .grid-cols-2 {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
}

/* ===== HOW IT WORKS SECTION ===== */
@media (max-width: 768px) {

  /* Stack steps vertically */
  .how-it-works-grid,
  div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }

  /* Stack benefits vertically */
  .why-choose-grid,
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* Step icons */
  div[style*="width: 80px; height: 80px"] {
    width: 70px !important;
    height: 70px !important;
    font-size: 1.75rem !important;
  }
}

@media (max-width: 480px) {

  .how-it-works-grid,
  div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

/* ===== NEWSLETTER SECTION ===== */
@media (max-width: 768px) {
  section.container>div[style*="background: linear-gradient(135deg, var(--primary)"] {
    padding: 2.5rem 1rem !important;
  }

  form[action="/api/subscribe-newsletter.php"] {
    flex-direction: column !important;
    padding: 0 0.5rem !important;
    gap: 0.75rem !important;
  }

  form[action="/api/subscribe-newsletter.php"] input,
  form[action="/api/subscribe-newsletter.php"] button {
    width: 100% !important;
    padding: 0.875rem !important;
    font-size: 1rem !important;
  }
}

/* ===== RECENT UPLOADS / CARDS WITH FLEX ===== */
@media (max-width: 768px) {
  .card[style*="display: flex"] {
    flex-direction: column !important;
    padding: 1.25rem !important;
  }

  .card[style*="display: flex"]>div[style*="width: 120px"] {
    width: 100% !important;
    height: 100px !important;
    margin-bottom: 1rem;
  }
}

/* ===== ITEM.PHP PAGE FIXES ===== */
@media (max-width: 992px) {

  /* Stack item layout */
  .item-layout,
  div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* Remove sticky positioning on mobile */
  aside>div[style*="position: sticky"] {
    position: relative !important;
    top: auto !important;
  }
}

/* Mobile optimized detail items */
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, var(--neutral-50) 0%, white 100%);
  border-radius: 6px;
  border-left: 3px solid var(--primary-light);
  margin-bottom: 0.75rem;
}

.detail-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--neutral-600);
  font-weight: 600;
}

.detail-value {
  font-size: 0.95rem;
  color: var(--neutral-900);
  font-weight: 500;
  word-break: break-word;
}

/* ===== GLOBAL CONTAINER PADDING ===== */
@media (max-width: 768px) {
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .page-title {
    font-size: 1.5rem !important;
    margin-bottom: 1.5rem !important;
    word-break: break-word !important;
  }
}

@media (max-width: 480px) {
  .container {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .page-title {
    font-size: 1.25rem !important;
  }
}

/* ===== PREVENT ALL SECTIONS FROM OVERFLOWING ===== */
@media (max-width: 768px) {

  main>section,
  section.container,
  section.container>div {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .grid,
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    width: 100% !important;
    overflow-x: hidden !important;
  }

  .card {
    max-width: 100% !important;
  }
}

/* ===== BREADCRUMB MOBILE ===== */
@media (max-width: 768px) {
  .breadcrumb {
    font-size: 0.75rem !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    padding-bottom: 0.5rem;
  }

  .breadcrumb::-webkit-scrollbar {
    height: 3px !important;
  }

  .breadcrumb::-webkit-scrollbar-thumb {
    background: var(--neutral-300) !important;
    border-radius: 3px !important;
  }
}

/* ===== BUTTONS MOBILE TOUCH TARGETS ===== */
@media (max-width: 768px) {

  button,
  a.btn-primary,
  a.btn-secondary,
  input[type="submit"] {
    min-height: 44px !important;
    min-width: 44px !important;
  }
}

/* ===== PURCHASE CARD MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {

  .purchase-card,
  aside>div {
    padding: 1.5rem 1rem !important;
  }

  .card-price {
    font-size: 1.75rem !important;
  }

  #guest-email,
  .guest-email-input,
  #guest-email-desktop {
    padding: 0.875rem !important;
    font-size: 1rem !important;
    min-height: 48px !important;
  }
}

/* ===== SHOW/HIDE MOBILE UTILITIES ===== */
.show-mobile {
  display: none;
}

@media (max-width: 992px) {
  .hide-mobile {
    display: none !important;
  }

  .show-mobile {
    display: block !important;
  }
}

/* ===== ENSURE PROPER TEXT WRAPPING ===== */
@media (max-width: 768px) {

  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  td,
  th,
  span,
  div {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
}

/* ===== ANIMATION KEYFRAMES ===== */
@keyframes float {

  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-20px) rotate(5deg);
  }
}

/* ===== ENHANCED BROWSE PAGE CARD STYLES ===== */

/* Browse page container */
.browse-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
}

/* Breadcrumb styling */
.breadcrumb {
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: var(--neutral-600);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.breadcrumb a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Enhanced navigation cards (levels, grades, terms) */
.browse-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  border: 2px solid var(--neutral-100);
  position: relative;
  overflow: hidden;
}

.browse-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.browse-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(4, 120, 87, 0.15);
  border-color: var(--primary-light);
}

.browse-card:hover::before {
  transform: scaleY(1);
}

.browse-card-content {
  flex: 1;
}

.browse-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--neutral-900);
  margin-bottom: 0.25rem;
}

.browse-card-subtitle {
  font-size: 0.875rem;
  color: var(--neutral-500);
}

.browse-card-arrow {
  width: 40px;
  height: 40px;
  background: var(--highlight);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.25rem;
  transition: all 0.3s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

.browse-card:hover .browse-card-arrow {
  background: var(--primary);
  color: white;
  transform: translateX(5px);
}

/* Document cards */
.document-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  border: 2px solid var(--neutral-100);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.document-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.document-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(4, 120, 87, 0.15);
  border-color: var(--primary-light);
}

.document-card:hover::before {
  transform: scaleX(1);
}

.document-card-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1rem;
  color: white;
}

.document-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--neutral-900);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.document-card-description {
  color: var(--neutral-600);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.document-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--neutral-100);
}

.document-card-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.document-card-downloads {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--neutral-500);
  font-size: 0.875rem;
}

.document-card-button {
  width: 100%;
  padding: 0.875rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.document-card-button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.3);
}

.document-card-button::after {
  content: "→";
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.document-card-button:hover::after {
  transform: translateX(5px);
}

/* Empty state */
.browse-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 12px;
  border: 2px dashed var(--neutral-200);
}

.browse-empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.browse-empty-state-title {
  font-size: 1.5rem;
  color: var(--neutral-900);
  margin-bottom: 0.5rem;
}

.browse-empty-state-text {
  color: var(--neutral-600);
  margin-bottom: 2rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .browse-card {
    padding: 1.5rem;
  }

  .browse-card-title {
    font-size: 1.1rem;
  }

  .browse-card-arrow {
    width: 35px;
    height: 35px;
    font-size: 1.1rem;
  }

  .document-card {
    padding: 1.25rem;
  }

  .document-card-title {
    font-size: 1rem;
  }

  .document-card-price {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .browse-container {
    padding: 1rem;
  }

  .browse-card {
    padding: 1.25rem;
  }

  .browse-card-title {
    font-size: 1rem;
  }

  .document-card-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .document-card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ========================================
   ELEGANT CATEGORY CARDS STYLES
   Add this to your style.css file
   ======================================== */

/* Category Grid Container */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 0 1rem;
}

/* Individual Category Card */
.category-card {
  position: relative;
  text-decoration: none;
  background: white;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  border: 2px solid transparent;
}

/* Hover Effect */
.category-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(4, 120, 87, 0.15);
  border-color: var(--primary);
}

/* Background decoration on hover */
.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #10b981);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.category-card:hover::before {
  transform: scaleX(1);
}

/* Icon Container */
.category-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, #f0fdf4 0%, #d1fae5 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s ease;
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.1);
  position: relative;
}

.category-card:hover .category-icon {
  transform: scale(1.1) rotate(5deg);
  background: linear-gradient(135deg, var(--primary), #10b981);
  box-shadow: 0 8px 24px rgba(4, 120, 87, 0.3);
}

.category-icon img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.category-card:hover .category-icon img {
  transform: scale(1.1);
  filter: brightness(0) invert(1);
  /* Makes icon white on hover */
}

/* Title */
.category-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--neutral-900);
  transition: color 0.3s ease;
}

.category-card:hover .category-title {
  color: var(--primary);
}

/* Description */
.category-description {
  font-size: 0.9rem;
  color: var(--neutral-600);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  min-height: 40px;
}

/* Arrow Button */
.category-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.category-arrow svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.category-card:hover .category-arrow {
  gap: 0.75rem;
}

.category-card:hover .category-arrow svg {
  transform: translateX(5px);
}

/* Pulse animation for icon on hover */
@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.1);
  }

  50% {
    box-shadow: 0 4px 24px rgba(4, 120, 87, 0.3);
  }
}

.category-card:hover .category-icon {
  animation: pulse 2s infinite;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 0 0.5rem;
  }

  .category-card {
    padding: 2rem 1.5rem;
  }

  .category-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.25rem;
  }

  .category-icon img {
    width: 50px;
    height: 50px;
  }

  .category-title {
    font-size: 1.1rem;
  }

  .category-description {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .category-card {
    padding: 1.75rem 1.25rem;
  }
}

/* Loading state animation */
.category-card.loading {
  pointer-events: none;
  opacity: 0.6;
}

/* Badge for count (optional enhancement) */
.category-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Alternative gradient backgrounds for variety */
.category-card:nth-child(3n+1) .category-icon {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.category-card:nth-child(3n+2) .category-icon {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.category-card:nth-child(3n+3) .category-icon {
  background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
}