/**
 * App Listings Manager - Frontend Styles
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

.alm-apps-listing {
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #ffffff;
  padding: 20px 10px;
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.alm-section {
  margin: 0 0 40px 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10px;
  box-sizing: border-box;
}

.alm-section h2 {
  font-size: 1.5rem;
  margin: 0 0 15px 0;
  color: #333;
  padding: 0 0 8px 0;
  font-weight: 600;
  border-bottom: 2px solid #F1D88B;
  text-align: left;
  width: 100%;
  max-width: 100%;
  width: 100%;
  max-width: 1200px;
  width: 100%;
  max-width: 1200px;
  margin-left: 0;
  padding-left: 0;
}

/* Apps Grid Layout – Fixed Columns */
.alm-apps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* Default mobile: 2 columns */
  gap: 20px;
  margin: 0;
  width: 100%;
  padding: 0;
  justify-content: center;
}

/* Tablet: 3 columns */
@media (min-width: 640px) {
  .alm-apps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop: 5 columns */
@media (min-width: 1024px) {
  .alm-apps-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Premium Category Hero Banner */
.alm-category-hero {
  background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 100%);
  padding: 80px 20px;
  text-align: center;
  color: white;
  margin-bottom: 60px;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 40px 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(237, 211, 134, 0.2);
}

/* Animated Background Shapes */
.alm-category-hero::before,
.alm-category-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 1;
  animation: floatShape 8s infinite alternate ease-in-out;
}

.alm-category-hero::before {
  top: -50px;
  left: -50px;
  width: 400px;
  height: 400px;
  background: rgba(237, 211, 134, 0.08);
  /* Gold glow */
}

.alm-category-hero::after {
  bottom: -50px;
  right: -50px;
  width: 300px;
  height: 300px;
  background: rgba(0, 200, 83, 0.05);
  /* Green glow */
  animation-delay: -4s;
}

@keyframes floatShape {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(20px, 30px) scale(1.1);
  }
}

/* Glassmorphism Content Box */
.alm-hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.alm-category-hero h1 {
  font-size: 3.5rem;
  margin: 0 0 20px 0;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(to right, #EDD386, #fff, #EDD386);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% auto;
  animation: shine 6s linear infinite;
  display: inline-block;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

.alm-category-hero p {
  color: #cbd5e1;
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
  font-weight: 300;
}

/* Card sizing – let the grid cell control width */
.alm-apps-grid .alm-app-card {
  width: 100%;
  min-width: 0;
  /* allow shrinking for mobile */
  height: 240px;
  margin: 0;
  text-decoration: none !important;
  flex-shrink: 0;
}


/* Mobile: force 2-3 columns, no gaps */
@media (max-width: 480px) {
  .alm-apps-listing {
    padding: 10px 5px;
    /* reduce padding */
  }

  .alm-section {
    padding: 0 5px;
    /* reduce padding */
  }

  .alm-apps-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    /* exactly 2 columns */
    gap: 5px;
    /* smaller gap for more width */
    margin: 0;
    padding: 0;
    width: 100%;
  }

  /* Target the grid child (the link wrapper) */
  .alm-app-card-link {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: block !important;
  }

  .alm-apps-grid .alm-app-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 220px;
  }

  .alm-app-card {
    width: 100% !important;
    min-width: 0 !important;
  }

  .alm-search-container {
    flex-direction: column;
    max-width: 100%;
  }

  .alm-search-btn {
    width: 100%;
    margin-top: 8px;
  }

  .alm-section h2 {
    font-size: 1.2rem;
    text-align: left;
  }

  .alm-view-more-container {
    text-align: center;
  }
}

/* Tablet/larger phones: 3 columns */
@media (min-width: 481px) and (max-width: 767px) {
  .alm-apps-listing {
    padding: 15px 5px;
    /* reduce padding */
  }

  .alm-section {
    padding: 0 5px;
    /* reduce padding */
  }

  .alm-apps-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    /* exactly 3 columns */
    gap: 8px;
    /* smaller gap for more width */
    margin: 0;
    padding: 0;
    width: 100%;
  }

  /* Target the grid child (the link wrapper) */
  .alm-app-card-link {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: block !important;
  }

  .alm-apps-grid .alm-app-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 230px;
  }

  .alm-app-card {
    width: 100%;
    min-width: 0;
  }

  .alm-search-container {
    flex-direction: column;
    max-width: 100%;
  }

  .alm-search-btn {
    width: 100%;
    margin-top: 8px;
  }

  .alm-section h2 {
    font-size: 1.3rem;
    text-align: left;
  }

  .alm-view-more-container {
    text-align: center;
  }
}

/* App Card Styles */
.alm-app-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  height: 240px;
  width: 100%;
  /* fill grid cell */
  min-width: 0;
  /* allow shrinking */
  display: flex;
  flex-direction: column;
  position: relative;
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
  transform: translateY(10px);
  border: 1px solid #F1D88B;
  margin: 0;
  text-decoration: none !important;
  outline: none !important;
}

/* Staggered animation delay for cards */
.alm-app-card:nth-child(2n) {
  animation-delay: 0.1s;
}

.alm-app-card:nth-child(3n) {
  animation-delay: 0.2s;
}

.alm-app-card:nth-child(4n) {
  animation-delay: 0.3s;
}

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

/* Hover Effects */
.alm-app-card:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border: 1px solid #00C853;
  z-index: 10;
}

/* App Image Container */
.alm-app-image-container {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  background-color: #fff9e6;
}

.alm-app-image-container img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.alm-app-placeholder {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e9ecef;
  border-radius: 8px;
  color: #6c757d;
  font-size: 0.8rem;
  text-align: center;
}

/* App Content */
.alm-app-content {
  padding: 12px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.alm-app-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 5px 0;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alm-app-version {
  font-size: 0.7rem;
  color: #888;
  margin: 0 0 8px 0;
  font-weight: 500;
}

.alm-app-rating {
  margin-top: auto;
  margin-bottom: 10px;
}

.alm-star {
  color: #ddd;
  font-size: 0.85rem;
}

.alm-star.filled {
  color: #FFD700;
}

/* App Card Link */
.alm-app-card-link {
  text-decoration: none !important;
  color: inherit;
  display: block;
  width: 100%;
  min-width: 0;
  /* allow shrinking for grid */
  max-width: 100%;
  /* don't overflow grid */
  height: 100%;
  outline: none !important;
}

.alm-app-card-link:hover,
.alm-app-card-link:focus,
.alm-app-card-link:active {
  text-decoration: none !important;
  color: inherit;
  outline: none !important;
  box-shadow: none !important;
}

/* Additional App Info */
.alm-app-tagline {
  font-size: 0.75rem;
  color: #666;
  margin: 5px 0;
  font-style: italic;
  height: 30px;
  overflow: hidden;
}

.alm-app-size {
  font-size: 0.7rem;
  color: #888;
  margin: 3px 0;
}

.alm-app-meta {
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
}

.alm-app-updated {
  font-size: 0.7rem;
  color: #00C853;
  font-weight: 500;
}

/* Ribbon Tags */
.alm-ribbon {
  position: absolute;
  top: 12px;
  left: -25px;
  background: linear-gradient(135deg, #F1D88B, #e0c77a);
  color: #333;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 25px;
  transform: rotate(-45deg);
  z-index: 5;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.alm-ribbon.new {
  background: linear-gradient(135deg, #00C853, #009d44);
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.alm-ribbon.updated {
  background: linear-gradient(135deg, #17a2b8, #138496);
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.alm-ribbon.mod {
  background: linear-gradient(135deg, #ffc107, #e0a800);
  color: #212529;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

/* Download Button */
.alm-download-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #00C853, #009d44);
  color: white;
  text-align: center;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
  margin-top: auto;
}

.alm-download-btn:hover {
  background: #009d44;
  box-shadow: 0 5px 15px rgba(0, 200, 83, 0.4);
  transform: translateY(-2px);
}

/* Ripple effect for download button */
.alm-download-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.alm-download-btn:focus:not(:active)::after {
  animation: ripple 1s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }

  100% {
    transform: scale(50, 50);
    opacity: 0;
  }
}

/* View More Button */
.alm-view-more-container {
  display: flex;
  justify-content: center;
  margin: 40px 0 20px;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
}

.alm-view-more-btn {
  padding: 14px 35px;
  background: linear-gradient(135deg, #F1D88B, #e0c77a);
  color: #333;
  border: none;
  border-radius: 30px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(241, 216, 139, 0.3);
  min-width: 180px;
  text-align: center;
  display: inline-block;
}

.alm-view-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(241, 216, 139, 0.4);
}

.alm-view-more-btn:active {
  transform: translateY(0);
}

.alm-view-more-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.alm-view-more-btn:hover {
  background: linear-gradient(135deg, #e0c77a, #cdb669);
  transform: translateY(-3px);
}

/* Search and Filter Container */
.alm-search-filter-container {
  margin: 0 auto 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 800px;
  padding: 20px;
  box-sizing: border-box;
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

/* Modern Search Input - Premium Design */
.alm-modern-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.1));
}

.alm-modern-search-input {
  width: 100%;
  padding: 18px 24px 18px 60px;
  /* Increased left padding to prevent icon overlap */
  border: 2px solid transparent;
  border-radius: 60px;
  font-size: 1rem;
  font-weight: 400;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  color: #273747;
  outline: none;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.3px;
}

.alm-modern-search-input:hover {
  border-color: rgba(237, 211, 134, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

.alm-modern-search-input:focus {
  background: #ffffff;
  box-shadow: 0 16px 48px rgba(237, 211, 134, 0.25),
    0 0 0 4px rgba(237, 211, 134, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  border-color: #EDD386;
  transform: translateY(-3px);
}

.alm-modern-search-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
  opacity: 1;
  transition: all 0.3s ease;
}

.alm-modern-search-input:focus::placeholder {
  color: #cbd5e1;
  transform: translateX(5px);
}

/* Search Icon - Fixed positioning to prevent overlap */
.alm-search-icon {
  position: absolute;
  left: 22px;
  /* Fixed position from left */
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 2;
  /* Ensure icon stays above input */
  width: 22px;
  height: 22px;
}

/* Icon color change on focus */
.alm-modern-search-wrapper:focus-within .alm-search-icon {
  color: #EDD386;
  transform: translateY(-50%) scale(1.1);
}

.alm-modern-search-wrapper:hover .alm-search-icon {
  color: #475569;
}

.alm-search-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.alm-category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 0 0;
  padding: 0;
  justify-content: flex-start;
  width: 100%;
}

.alm-category-btn {
  padding: 10px 20px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.alm-category-btn:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alm-category-btn.active {
  background: #F1D88B;
  border-color: #e0c77a;
  color: #333;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(241, 216, 139, 0.3);
  transform: translateY(-1px);
}

/* Loading spinner */
.alm-loading {
  display: none;
  width: 100%;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

.alm-loading:after {
  content: "";
  display: block;
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #F1D88B;
  border-radius: 50%;
  animation: alm-spin 1s linear infinite;
  margin-bottom: 15px;
}

.alm-loading-text {
  color: #6c757d;
  font-size: 1.1rem;
  margin-top: 15px;
  font-weight: 500;
}

@keyframes alm-spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Ensure the container is centered */
.alm-apps-listing {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.alm-section {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 0 20px;
  box-sizing: border-box;
}

/* Search Results Section */
.alm-search-results {
  animation: fadeIn 0.5s ease forwards;
}

.alm-search-results .alm-apps-grid {
  min-height: 100px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 180px));
  gap: 16px;
  margin-bottom: 20px;
}

.alm-search-results .alm-apps-grid .alm-app-card {
  width: 100%;
  min-width: 160px !important;
  max-width: 180px;
  height: 240px;
}

.alm-search-results h2 {
  color: #00C853;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* No Results Message */
.alm-no-results {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
  font-size: 1.2rem;
  font-weight: 500;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  margin: 20px 0;
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

.alm-no-results:before {
  content: "\f534";
  font-family: 'dashicons';
  font-size: 48px;
  color: #F1D88B;
  margin-bottom: 20px;
  display: block;
  line-height: 1;
}

@keyframes alm-spinner {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Widget specific overrides */
.alm-widget .alm-search-filter-container {
  background: transparent;
  box-shadow: none;
  padding: 0;
  max-width: 100%;
  margin: 0;
  border-radius: 0;
}

/* Single App Page Styles */
.alm-single-app-wrapper {
  font-family: 'Poppins', sans-serif;
}

.alm-app-header-bg {
  background-size: cover;
  background-position: center;
}

.alm-download-btn-lg {
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px 0 rgba(0, 200, 83, 0.39);
}

.alm-download-btn-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 200, 83, 0.23);
}

/* Prose overrides for better readability */
.prose p {
  margin-bottom: 1.5em;
}

.prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 1em;
  color: #273747;
}

.prose ul {
  list-style-type: disc;
  padding-left: 1.5em;
  margin-bottom: 1.5em;
}

.prose li {
  margin-bottom: 0.5em;
}

/* Hide scrollbar for horizontal scrolling areas */
.alm-hide-scrollbar::-webkit-scrollbar {
  display: none;
}

.alm-hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Safe area padding for mobile sticky bar */
.safe-area-pb {
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Search Widget Container - Premium Design */
.alm-search-widget-container {
  width: 100%;
  margin-bottom: 30px;
  padding: 30px 20px;
  background: linear-gradient(135deg, rgba(237, 211, 134, 0.08) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(237, 211, 134, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

.alm-search-widget-container:hover {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.alm-widget.alm-search-widget {
  width: 100%;
}

/* Responsive adjustments for widget */
@media (max-width: 768px) {
  .alm-search-widget-container {
    padding: 20px 15px;
    margin-bottom: 20px;
  }

  .alm-modern-search-input {
    font-size: 0.95rem;
    padding: 16px 20px 16px 55px;
  }

  .alm-search-icon {
    left: 18px;
  }

  .alm-search-icon svg {
    width: 20px;
    height: 20px;
  }
}