/* Themes Page - Modern Card-Based Design with Skeuomorphic Styling */

/* Hero Section */
.themes-hero {
  margin-bottom: 40px;
  padding: 30px;
  background: linear-gradient(135deg, #a0826d 0%, #8b7355 50%, #7a6a52 100%);
  background-image:
    linear-gradient(135deg, rgba(160, 130, 90, 0.7) 0%, rgba(139, 115, 85, 0.7) 50%, rgba(122, 106, 82, 0.7) 100%),
    var(--leather-seamless, url('../Seamleather.png'));
  background-size: 100% 100%, var(--leather-tile-size, 168px) var(--leather-tile-size, 168px);
  background-repeat: no-repeat, repeat;
  border-radius: 16px;
  border: 2px solid #6b5a45;
  box-shadow: 0 8px 20px rgba(42, 24, 12, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #f0e6d2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.themes-hero h1 {
  margin: 0 0 12px 0;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff5e6;
}

.themes-hero h1 .material-icons {
  font-size: 2rem;
  opacity: 0.9;
}

.themes-intro {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #e8d4b8;
  opacity: 0.95;
}

.themes-intro kbd {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 0.85em;
  color: #fff5e6;
}

/* Section Headers */
.themes-section {
  margin-bottom: 32px;
}

.themes-section h2 {
  margin: 0 0 20px 0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #333;
  text-shadow: none;
}

.themes-section h2 .material-icons {
  font-size: 1.5rem;
  opacity: 0.7;
}

/* Panels (Button Style, Legacy) */
.themes-panel {
  padding: 24px;
  background: linear-gradient(135deg, #d0b589 0%, #c49d7a 50%, #b88968 100%);
  background-image:
    linear-gradient(135deg, rgba(208, 181, 137, 0.6) 0%, rgba(196, 157, 122, 0.5) 50%, rgba(184, 137, 104, 0.6) 100%),
    var(--leather-seamless, url('../Seamleather.png'));
  background-size: 100% 100%, var(--leather-tile-size, 168px) var(--leather-tile-size, 168px);
  background-repeat: no-repeat, repeat;
  border: 2px solid #9b7d5f;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(42, 24, 12, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #2c1810;
  transition: all 0.2s ease;
}

.themes-panel:hover {
  box-shadow: 0 8px 20px rgba(42, 24, 12, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.button-style-label {
  display: block;
  font-weight: 600;
  color: #3a2515;
  margin-bottom: 12px;
  font-size: 1rem;
}

.themes-panel .hint {
  margin: 12px 0 0 0;
  font-size: 0.85rem;
  color: #5a4a35;
  opacity: 0.85;
}

/* Legacy Option Panel */
.legacy-option {
  text-align: center;
}

.legacy-option p {
  margin: 0 0 16px 0;
  font-size: 1rem;
  color: #3a2515;
}

.themes-reset-btn {
  width: auto !important;
  padding: 10px 20px !important;
  font-size: 0.95rem;
  min-width: 180px;
}

/* Theme Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  width: 100%;
  margin: 0;
}

@media (max-width: 1024px) {
  .theme-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .theme-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 480px) {
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* Theme Cards */
.theme-card {
  background: linear-gradient(135deg, #d0b589 0%, #c49d7a 100%);
  background-image:
    linear-gradient(135deg, rgba(208, 181, 137, 0.5) 0%, rgba(196, 157, 122, 0.4) 100%),
    var(--leather-seamless, url('../Seamleather.png'));
  background-size: 100% 100%, var(--leather-tile-size, 168px) var(--leather-tile-size, 168px);
  background-repeat: no-repeat, repeat;
  border: 2px solid #9b7d5f;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(42, 24, 12, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  position: relative;
}

.theme-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(42, 24, 12, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.theme-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.theme-card .info {
  padding: 12px;
}

.theme-card h3 {
  margin: 0 0 6px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #3a2515;
  line-height: 1.3;
}

.theme-card p {
  margin: 0 0 10px 0;
  font-size: 0.8rem;
  color: #5a4a35;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.theme-card .badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  color: #5a4a35;
  margin-bottom: 8px;
}

.theme-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.theme-actions .nav-btn {
  padding: 6px 10px !important;
  font-size: 0.8rem;
  flex: 1;
  min-width: 60px;
}

/* Dropdown Styles */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: fixed;
  background: linear-gradient(135deg, #fff5e6 0%, #f5e6d3 100%);
  border: 2px solid #d0b589;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(42, 24, 12, 0.3);
  min-width: 180px;
  z-index: 99999;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.dropdown-menu.show {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 0.95rem;
  color: #3a2515;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: rgba(208, 181, 137, 0.3);
  color: #2c1810;
}

.dropdown-item:active {
  background: rgba(208, 181, 137, 0.5);
}

.dropdown-item:not(:last-child) {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* ===== THEME MODAL STYLES ===== */

.theme-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.theme-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.theme-modal-panel {
  background: linear-gradient(135deg, #d0b589 0%, #c49d7a 100%);
  background-image:
    linear-gradient(135deg, rgba(208, 181, 137, 0.7) 0%, rgba(196, 157, 122, 0.6) 100%),
    var(--leather-seamless, url('../Seamleather.png'));
  background-size: 100% 100%, var(--leather-tile-size, 168px) var(--leather-tile-size, 168px);
  background-repeat: no-repeat, repeat;
  border: 3px solid #9b7d5f;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-modal-overlay.open .theme-modal-panel {
  transform: scale(1);
}

.theme-modal-header {
  padding: 24px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.theme-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #3a2515;
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-modal-header h2 .material-icons {
  font-size: 1.5rem;
  opacity: 0.8;
}

.theme-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #5a4a35;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 6px;
}

.theme-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #3a2515;
}

.theme-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.theme-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  margin: 0;
}

.theme-modal-card {
  background: linear-gradient(135deg, #fff5e6 0%, #f5e6d3 100%);
  border: 2px solid #d0b589;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(42, 24, 12, 0.15);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.theme-modal-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(42, 24, 12, 0.25);
  border-color: #b88968;
}

.theme-modal-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.theme-modal-card .modal-theme-name {
  padding: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #3a2515;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-modal-card.active {
  border-color: #8b7355;
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.3);
  background: linear-gradient(135deg, #d0b589 0%, #c49d7a 100%);
}

.theme-modal-card.active .modal-theme-name {
  color: #3a2515;
  font-weight: 700;
}

.theme-modal-footer {
  padding: 20px 24px;
  border-top: 2px solid rgba(0, 0, 0, 0.1);
  text-align: center;
  flex-shrink: 0;
}

.theme-modal-footer a {
  color: #3a2515;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.theme-modal-footer a:hover {
  color: #1a0f08;
}

/* Scrollbar styling for modal */
.theme-modal-panel::-webkit-scrollbar {
  width: 8px;
}

.theme-modal-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.theme-modal-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.theme-modal-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .themes-hero {
    padding: 20px;
    margin-bottom: 30px;
  }

  .themes-hero h1 {
    font-size: 1.5rem;
  }

  .themes-intro {
    font-size: 0.9rem;
  }

  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .theme-modal-panel {
    max-height: 90vh;
    border-radius: 12px;
  }

  .theme-modal-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .theme-modal-header,
  .theme-modal-body,
  .theme-modal-footer {
    padding: 16px;
  }
}
