/**
 * 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;
  max-width: 1200px;
  width: 100%;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #ffffff;
  padding: 20px 20px 20px 0;
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
}

.alm-section {
  margin: 0 0 40px 0;
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 0 0 20px;
  position: relative;
  left: 0;
  right: 0;
  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 */
.alm-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 160px);
  gap: 20px;
  margin: 0;
  width: 100%;
  padding: 0;
  justify-content: flex-start;
  align-items: flex-start;
  justify-items: flex-start;
}

/* Ensure consistent card sizing */
.alm-apps-grid .alm-app-card {
  width: 160px;
  min-width: 160px !important;
  height: 240px;
  margin: 0;
  text-decoration: none !important;
  flex-shrink: 0;
}

@media (min-width: 576px) and (max-width: 767px) {
  .alm-apps-grid {
    grid-template-columns: repeat(auto-fill, 140px);
    gap: 15px;
    padding: 0;
    width: 100%;
    justify-content: flex-start;
  }
  
  .alm-app-card {
    max-width: 100%;
    margin: 0;
  }
  
  .alm-search-filter-container {
    padding: 0 10px;
  }
  
  .alm-section h2 {
    padding: 0 10px;
    font-size: 1.5rem;
  }
  
  .alm-category-filter {
    overflow-x: auto;
    padding-bottom: 5px;
    margin: 10px 10px 0;
    width: calc(100% - 20px);
  }
  
  .alm-search-container {
    padding: 0 10px;
    width: calc(100% - 20px);
  }
  
  .alm-view-more-container {
    padding: 0 10px;
  }
}

@media (max-width: 767px) {
  .alm-apps-listing {
    padding: 20px 10px;
  }
  
  .alm-section {
    padding: 0 10px;
  }
  
  .alm-apps-grid {
    grid-template-columns: repeat(auto-fill, 140px);
    gap: 10px;
    margin: 0;
    padding: 0;
    justify-content: flex-start;
  }
  
  .alm-apps-grid .alm-app-card {
    width: 100%;
    max-width: 100%;
  }
  
  .alm-app-card {
    max-width: 100%;
    margin: 0 auto;
  }
  
  .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: center;
  }
  
  .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: 160px;
  min-width: 160px !important;
  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%;
  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);
}

.alm-search-container {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 700px;
  justify-content: center;
}

.alm-search-input {
  flex-grow: 1;
  padding: 14px 24px;
  border: 2px solid #e0e0e0;
  border-radius: 30px;
  font-size: 1.05rem;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 600px;
  box-sizing: border-box;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.alm-search-input:focus {
  border-color: #F1D88B;
  box-shadow: 0 0 0 3px rgba(241, 216, 139, 0.3);
  outline: none;
}

.alm-search-btn {
  padding: 14px 32px;
  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;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(241, 216, 139, 0.3);
  min-width: 120px;
  text-align: center;
}

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

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

.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);
  }
}