/**
 * Theme Detector Plugin Styles
 * Version: 2.1.0
 */

:root {
  --td-primary: #3858e9;
  --td-primary-dark: #2d47c7;
  --td-secondary: #7e3bd0;
  --td-light-bg: #f0f5fa;
  --td-dark-text: #1e1e1e;
  --td-light-text: #777777;
  --td-border: #e0e6ec;
  --td-success: #00a32a;
  --td-danger: #d63638;
  --td-warning: #dba617;
  --td-radius: 4px;
  --td-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --td-transition: all 0.2s ease;
}

/* Main container */
.theme-detector-container {
  max-width: 100%;
  color: var(--td-dark-text);
  margin-bottom: 2rem;
}

/* Form styling */
#theme-detector-form {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: var(--td-light-bg);
  border-radius: var(--td-radius);
}

.input-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
    gap: 0.75rem;
}

#theme-detector-form label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--td-dark-text);
  margin-bottom: 0.5rem;
  display: block;
}

#theme-detector-form input[type="text"] {
  flex: 1;
  min-width: 250px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  transition: var(--td-transition);
}

#theme-detector-form input[type="text"]:focus {
  border-color: var(--td-primary);
  box-shadow: 0 0 0 1px var(--td-primary);
  outline: none;
}

#theme-detector-form button {
  background-color: var(--td-primary);
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: var(--td-radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--td-transition);
  white-space: nowrap;
}

#theme-detector-form button:hover {
  background-color: var(--td-primary-dark);
  transform: translateY(-1px);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--td-light-text);
  margin-top: 0.5rem;
  padding-left: 0.25rem;
}

/* Loading indicator */
.theme-detector-loading {
  text-align: center;
  padding: 2rem;
  color: var(--td-light-text);
}

.theme-detector-loading .spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--td-primary);
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Results container */
.theme-detector-results {
  margin-top: 1.5rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background-color: var(--td-light-bg);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius) var(--td-radius) 0 0; /* Top corners rounded */
  margin-bottom: -1px; /* Overlap border with theme info */
  position: relative; /* Ensure it sits above theme-info border */
  z-index: 1;
}

.last-parsed-info {
  margin: 0;
  font-size: 0.85rem;
  color: var(--td-light-text);
}

#force-refresh-button {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  height: auto;
  line-height: 1.4;
  vertical-align: middle;
}

#force-refresh-button .dashicons.spin {
  animation: spin 1s linear infinite;
}

/* Theme info styling */
.theme-info {
  background-color: white;
  border-radius: 0 0 var(--td-radius) var(--td-radius); /* Bottom corners rounded */
  box-shadow: var(--td-shadow);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.theme-info .left-col {
  flex: 0 0 220px;
}

.theme-info .theme-details {
  flex: 1;
  min-width: 250px;
}

.theme-screenshot {
  margin-bottom: 1rem;
  position: relative;
  border-radius: var(--td-radius);
  overflow: hidden;
  box-shadow: var(--td-shadow);
}

.theme-screenshot img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--td-radius);
}

.theme-details h3 {
  font-size: 1.4rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--td-dark-text);
  position: relative;
  padding-bottom: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;

}

.theme-rating {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.theme-rating .stars {
  color: var(--td-warning);
  margin-right: 0.5rem;
}

.theme-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.theme-meta-item {
  background-color: var(--td-light-bg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--td-radius);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

.theme-meta-item .dashicon {
  margin-right: 0.25rem;
  color: var(--td-primary);
}

/* Theme details list */
.theme-details-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0 0;
}

.theme-details-list li {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--td-border);
  display: flex;
  flex-wrap: wrap;
  text-transform: capitalize;
}

.theme-details-list li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.theme-details-list li a {
    text-transform: none;
}

.theme-details-list li strong {
  min-width: 120px;
  color: var(--td-dark-text);
  margin-right: 1rem;
  font-weight: 600;
}

/* Premium Button */
.premium-button {
  display: inline-flex;
  align-items: center;
  background-color: var(--td-success);
  color: white !important;
  padding: 0.6rem 1rem;
  border-radius: var(--td-radius);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 1rem;
  transition: var(--td-transition);
}

.premium-button .dashicons {
  margin-right: 0.4rem;
  font-size: 1.1em;
  line-height: 1;
}

.premium-button:hover {
  background-color: #008a24;
  color: white !important;
}

/* Plugin information styling */
.plugin-info {
  background-color: white;
  border-radius: var(--td-radius);
  box-shadow: var(--td-shadow);
  padding: 1.5rem;
}

.plugin-info h2 {
  color: var(--td-dark-text);
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  position: relative;
  padding-bottom: 0.75rem;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.plugin-list {
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 1.5rem;

  display: grid;
   grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.plugin-item {
  overflow: hidden;
  transition: var(--td-transition);
  display: flex;
  flex-direction: column;
  border: 1px solid #d9d9d9;
  border-radius: 5px;
  padding: 0 0 20px;
  background: #f7f8f9;
}

.plugin-banner {
  overflow: hidden;
  position: relative;
  background-color: #f2f6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;

}

.plugin-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px 4px 0 0;
}


.plugin-header {
  display: flex;
  position: relative;
}

.plugin-icon.no-icon:before {
  content: '';
  font-family: "dashicons";
  content: "\f111";
  font-size: 32px;
  color: #c0c5ca;
}

.plugin-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.plugin-info-header {
  margin-bottom: 0.75rem;
}

.plugin-position {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: var(--td-secondary);
  color: white;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.plugin-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--td-dark-text);
  font-size: 1.1rem;
  padding-right: 40px;
}

.plugin-name a {
  color: var(--td-dark-text);
  text-decoration: none;
  transition: color 0.2s;
}

.plugin-name a:hover {
  color: var(--td-primary);
}

.plugin-description {
  font-size: 0.9rem;
  color: var(--td-light-text);
  margin-bottom: 1rem;
  line-height: 1.5;
  flex-grow: 1;
}

.plugin-badges {
  display: flex;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.plugin-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.plugin-badge.free {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.plugin-badge.premium {
  background-color: #fff8e1;
  color: #f57c00;
}

.plugin-badge.popular {
  background-color: #e3f2fd;
  color: #1565c0;
}

.plugin-badge.new {
  background-color: #f3e5f5;
  color: #7b1fa2;
}

.plugin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--td-light-text);

  margin-top: auto;
}

.plugin-meta-item {
  display: flex;
  align-items: center;
}

.plugin-meta-item .dashicons {
  font-size: 1rem;
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
  color: var(--td-light-text);
}

.plugin-actions {
    padding: 0 20px 20px;
}
.plugin-actions a {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  text-align: center;
  transition: all 0.2s;
  text-decoration: none;
}

.plugin-actions .download-btn {
  background-color: var(--td-primary);
  color: white;
  text-decoration: none;

}

.plugin-actions .download-btn:hover {
  background-color: var(--td-primary-dark);
}

.plugin-actions .info-btn {
  background-color: #f5f5f7;
  color: var(--td-dark-text);
  text-decoration: none;

}

.plugin-actions .info-btn:hover {
  background-color: #e8e8ea;
}

.plugin-actions .affiliate-button {
  background-color: var(--td-success);
  color: white !important;
  text-decoration: none;

}

.plugin-actions .affiliate-button:hover {
  background-color: #008a24;
}

/* Error message */
.theme-detector-error {
  background-color: #fef8f8;
  border-left: 4px solid var(--td-danger);
  color: var(--td-danger);
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 0 var(--td-radius) var(--td-radius) 0;
}

/* Responsive adjustments */
@media screen and (max-width: 600px) {
  .input-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  #theme-detector-form input[type="url"] {
    width: 100%;
  }
  
  .theme-info {
    flex-direction: column;
    gap: 1rem;
  }
  
  .theme-details-list li {
    flex-direction: column;
  }
  
  .theme-details-list li strong {
    margin-bottom: 0.25rem;
  }
  
  .plugin-list {
    grid-template-columns: 1fr;
  }
}

/* Top Lists Styling */
.theme-detector-top-list {
  margin-bottom: 2rem;
}

.theme-detector-top-list h3 {
}

.theme-detector-top-list ol,
.theme-detector-top-list li {
}

/* New Card Styles */
.td-top-item-card {
  display: flex;
  background-color: #fff;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s ease;
}

.td-top-item-card:hover {
   box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.td-card-rank {
  flex: 0 0 50px;
  background-color: var(--td-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 600;
  position: relative;
}

.td-card-rank span {
    line-height: 1;
}

.td-card-thumb {
  flex: 0 0 150px;
  background-color: #f7f8fa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--td-border);
}

.td-card-thumb.plugin img {
   max-width: 100%;
   max-height: 100%;
   height: auto;
   width: auto; 
   object-fit: contain; /* Better for icons/banners */
   padding: 10px;
}

.td-card-thumb.theme img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.td-no-icon {
    font-size: 48px;
    color: #dcdfe4;
}

.td-card-details {
  flex: 1 1 300px; /* Grow and basis */
  padding: 1rem 1.5rem;
}

.td-card-title {
  margin-top: 0;
  margin-bottom: 0.25rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--td-dark-text);
}

.td-card-author {
  font-size: 0.85rem;
  color: var(--td-light-text);
  margin-bottom: 0.75rem;
}

.td-card-author a {
    color: var(--td-light-text);
    text-decoration: none;
}
.td-card-author a:hover {
    text-decoration: underline;
}

.td-card-description {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.5;
  margin-bottom: 0;
}

.td-card-meta {
  flex: 1 1 200px;
  padding: 1rem 1.5rem;
  border-left: 1px solid var(--td-border);
  background-color: #fdfdfd;
  font-size: 0.85rem;
  color: var(--td-light-text);
}

.td-card-stat {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}
.td-card-stat:last-child {
    margin-bottom: 0;
}

.td-card-stat .dashicons {
    margin-right: 0.4rem;
    color: #a0a5aa;
}

.td-card-stat strong {
    color: var(--td-dark-text);
    margin: 0 0.25rem;
}

.td-card-actions {
  flex: 0 0 180px;
  padding: 1rem;
  border-left: 1px solid var(--td-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
}

.td-button {
  display: inline-block;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--td-radius);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.td-button-dl {
  background-color: var(--td-primary);
  color: white !important;
}
.td-button-dl:hover {
  background-color: var(--td-primary-dark);
  color: white !important;
}

.td-button-premium,
.td-button-affiliate {
  background-color: #e8f5e9;
  border-color: #a5d6a7;
  color: #2e7d32 !important;
}
.td-button-premium:hover,
.td-button-affiliate:hover {
  background-color: #c8e6c9;
  border-color: #81c784;
  color: #1b5e20 !important;
}

.td-button-tag {
    background-color: #f5f5f5;
    color: #666 !important;
    cursor: default;
}
.td-button-tag.premium {
    background-color: #fff8e1;
    color: #f57c00 !important;
}

/* Responsive adjustments */
@media screen and (max-width: 1200px) {
    .td-card-meta {
        border-left: none;
        border-top: 1px solid var(--td-border);
    }
    .td-top-item-card {
        flex-wrap: wrap;
    }
    .td-card-details { order: 1; flex-basis: calc(100% - 200px); }
    .td-card-thumb { order: 2; }
    .td-card-meta { order: 3; flex-basis: 100%; }
    .td-card-actions { order: 4; flex-basis: 100%; border-left: none; border-top: 1px solid var(--td-border); flex-direction: row; }
}

@media screen and (max-width: 782px) {
    .td-card-rank { flex-basis: 40px; font-size: 1.1rem; }
    .td-card-thumb { flex: 0 0 100px; } 
    .td-card-details { flex-basis: calc(100% - 140px); padding: 1rem; }
    .td-card-title { font-size: 1rem; }
    .td-card-actions { flex-direction: column; }
    .td-card-meta { padding: 1rem; }
}

@media screen and (max-width: 600px) {
    .td-card-thumb { display: none; } 
    .td-card-details { flex-basis: calc(100% - 40px); }
}

/* Hosting Information Styles */
.td-hosting-info {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    padding: 1.5rem;
}

.td-hosting-info h3 {
    color: #23282d;
    font-size: 1.2rem;
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.td-hosting-info .dashicons {
    color: #2271b1;
}

.td-hosting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.td-hosting-item {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 1rem;
}

.td-hosting-item h4 {
    color: #1d2327;
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.td-hosting-item ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.td-hosting-item li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #50575e;
}

.td-hosting-item li strong {
    color: #1d2327;
    display: inline-block;
    min-width: 120px;
}

@media (max-width: 600px) {
    .td-hosting-grid {
        grid-template-columns: 1fr;
    }
    
    .td-hosting-item li strong {
        display: block;
        margin-bottom: 0.25rem;
    }
}
