/* ═══════════════════════════════════════════════════════════════════════════
   COMPONENTS - Buttons, Tiles, Cards, etc.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Buttons */
.help-btn, .info-btn, .settings-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(212, 165, 116, 0.5);
  color: #d4a574;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-btn:hover, .info-btn:hover, .settings-btn:hover {
  background: rgba(212, 165, 116, 0.2);
  transform: scale(1.1);
  border-color: #d4a574;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  padding: 12px 28px;
  border-radius: 12px;
  color: #f5f5f5;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  position: relative;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.tab-btn.active {
  background: linear-gradient(135deg, #d4a574, #8b6f47);
  border-color: #d4a574;
  color: #1a1a2e;
}

.buy-mode-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: 10px;
  color: #f5f5f5;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.buy-mode-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.buy-mode-btn.active {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  border-color: #4CAF50;
  color: #fff;
}

.buy-mode-btn[data-type="sell"].active {
  background: linear-gradient(135deg, #ff6b6b, #ff5252);
  border-color: #ff6b6b;
  color: #fff;
}

.buy-btn, .sell-btn, .upgrade-buy-btn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  min-height: 48px;
}

.sell-btn {
  background: linear-gradient(135deg, #ff6b6b, #ff5252);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.buy-btn:hover:not(:disabled), .sell-btn:hover:not(:disabled), .upgrade-buy-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.sell-btn:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
}

.buy-btn:active:not(:disabled), .sell-btn:active:not(:disabled), .upgrade-buy-btn:active:not(:disabled) {
  transform: translateY(0);
}

.buy-btn:disabled, .sell-btn:disabled, .upgrade-buy-btn:disabled {
  background: rgba(100, 100, 100, 0.5);
  cursor: not-allowed;
  box-shadow: none;
}

.prestige-button {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  border: none;
  padding: 20px 48px;
  border-radius: 16px;
  color: #1a1a2e;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
  display: block;
  margin: 24px auto;
  width: 100%;
  max-width: 400px;
}

.prestige-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(255, 215, 0, 0.5);
}

.prestige-button:disabled {
  background: rgba(100, 100, 100, 0.5);
  cursor: not-allowed;
  opacity: 0.5;
}

.start-btn {
  background: linear-gradient(135deg, #d4a574, #8b6f47);
  border: none;
  padding: 16px 48px;
  border-radius: 12px;
  color: #1a1a2e;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: block;
  margin: 24px auto 0;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 165, 116, 0.5);
}

/* Action Buttons */
.action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: 8px;
  color: #f5f5f5;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: auto;
  height: auto;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.action-btn.danger {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.action-btn.danger:hover {
  background: rgba(255, 107, 107, 0.1);
}

/* Coffee Button */
#coffeeButton {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4a574, #8b6f47);
  border: none;
  font-size: 4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 24px rgba(212, 165, 116, 0.4);
  margin: 20px auto;
  display: block;
}

#coffeeButton:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(212, 165, 116, 0.5);
}

#coffeeButton:active {
  transform: scale(0.95);
}

/* Badges */
.notification-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  min-width: 7px;
  padding: 0;
  margin-left: 0;
  border-radius: 50%;
  font-size: 0;
  border: 1px solid #1a1a2e;
  pointer-events: none;
  background: #ff4444;
}

/* Shop Items */
.shop-item, .upgrade-item {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.shop-item:hover, .upgrade-item:hover {
  border-color: rgba(212, 165, 116, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.shop-item.affordable, .upgrade-item.affordable {
  border-color: rgba(76, 175, 80, 0.5);
  background: rgba(76, 175, 80, 0.1);
}

.shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
}

.item-info {
  flex: 1;
  min-width: 200px;
}

.item-name, .upgrade-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #d4a574;
  line-height: 1.2;
}

.item-effect {
  font-size: 1.1rem;
  opacity: 0.9;
  line-height: 1.3;
}

.item-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.quantity-display {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}

.cost-tile {
  background: rgba(212, 165, 116, 0.2);
  border: 2px solid rgba(212, 165, 116, 0.5);
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #d4a574;
  min-width: 120px;
  text-align: center;
}

.sell-section {
  display: flex;
  align-items: center;
  padding: 4px 8px;
}

.buy-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-display {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}

.cost-tile {
  background: rgba(212, 165, 116, 0.2);
  border: 2px solid rgba(212, 165, 116, 0.5);
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #d4a574;
  min-width: 120px;
  text-align: center;
}

/* Upgrades */
.upgrade-item.purchased {
  border-color: rgba(255, 215, 0, 0.5);
  background: rgba(255, 215, 0, 0.1);
  opacity: 0.6;
}

.upgrade-item.locked {
  border-color: rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  opacity: 0.5;
}

.upgrade-item.locked:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.upgrade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.upgrade-name {
  flex: 1;
  min-width: 0;
}

.upgrade-status {
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffd700;
  white-space: nowrap;
  flex-shrink: 0;
}

.upgrade-status.locked {
  color: #ff6b6b;
}

.upgrade-description {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 16px;
  opacity: 0.9;
}

.upgrade-unlock-req {
  font-size: 0.9rem;
  color: #ff6b6b;
  margin-top: 8px;
  font-style: italic;
}

.upgrade-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upgrade-pack {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  margin-bottom: 16px;
}

.upgrade-pack:hover {
  border-color: rgba(212, 165, 116, 0.5);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.upgrade-pack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.upgrade-pack-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #d4a574;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upgrade-pack-icon {
  font-size: 1.5rem;
}

.upgrade-pack-progress {
  font-size: 1.1rem;
  font-weight: 600;
  color: #4CAF50;
}

.upgrade-pack-description {
  opacity: 0.9;
  margin-bottom: 12px;
}

.upgrade-pack-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.upgrade-pack-badge {
  font-size: 1.5rem;
}

.upgrade-pack-toggle {
  font-size: 1rem;
  opacity: 0.6;
  margin-top: 8px;
  text-align: center;
  font-weight: 600;
}

.upgrade-pack-content {
  max-height: 10000px;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
  margin-top: 16px;
  overflow: visible;
}

.upgrade-pack-content.collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
}

/* Achievements */
.achievement {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
}

.achievement.unlocked {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.achievement.claimed {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.1);
}

.achievement-pack {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.achievement-pack:hover {
  border-color: rgba(212, 165, 116, 0.5);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.achievement-pack .notification-badge {
  top: 16px;
  right: 16px;
}

.pack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pack-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #d4a574;
}

.pack-progress {
  font-size: 1.1rem;
  font-weight: 600;
  color: #4CAF50;
}

.pack-description {
  opacity: 0.9;
  margin-bottom: 12px;
}

.pack-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pack-badge {
  font-size: 1.5rem;
}

.achievement-reward {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: #4CAF50;
  font-weight: 600;
}

/* Progress Bar */
.progress {
  height: 8px;
  background: #555;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  height: 100%;
  background: #d2691e;
  transition: width 0.3s;
}

/* Prestige Info */
.prestige-info {
  background: rgba(255, 215, 0, 0.1);
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(135deg, #2d2d2d, #1a1a2e);
  border: 3px solid #d4a574;
  border-radius: 20px;
  padding: 32px;
  max-width: 900px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 2rem;
  font-weight: 700;
  color: #d4a574;
}

.modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #f5f5f5;
  font-size: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.modal-achievements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.modal-achievement {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
}

.modal-achievement.unlocked {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.modal-achievement.claimed {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.1);
}

.modal-achievement.unclaimed {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.15);
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
  animation: achievement-glow 2s ease-in-out infinite;
}

.modal-achievement.unclaimed:hover {
  transform: scale(1.02);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

.version-content {
  line-height: 1.8;
}

.version-content h3 {
  color: #d4a574;
  margin-top: 24px;
  margin-bottom: 12px;
}

.version-content ul {
  margin: 12px 0;
  padding-left: 24px;
}

.version-content li {
  margin: 8px 0;
}

.version-content a {
  color: #4CAF50;
  text-decoration: none;
  transition: color 0.3s ease;
}

.version-content a:hover {
  color: #66BB6A;
  text-decoration: underline;
}

/* Overlay & Instructions */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.overlay.hidden { 
  display: none; 
}

.instructions-modal {
  background: linear-gradient(135deg, #2d2d2d, #1a1a2e);
  border: 3px solid #d4a574;
  border-radius: 20px;
  padding: 40px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  max-height: 90vh;
  overflow-y: auto;
}

.instructions-modal h2 {
  margin-top: 0;
  color: #d4a574;
  font-size: 2rem;
  text-align: center;
}

.key-guide {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}

.key-item {
  display: flex;
  align-items: center;
  margin: 8px 0;
}

.key {
  background: linear-gradient(135deg, #d4a574, #8b6f47);
  color: #1a1a2e;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
  margin-right: 16px;
}

/* Notifications */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
}

.notification {
  background: linear-gradient(135deg, #2d2d2d, #1a1a2e);
  border: 2px solid #d4a574;
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  animation: slideInNotif 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  opacity: 1;
  transform: translateX(0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0;
}

.notification:hover {
  transform: translateX(-4px);
}

.notification.fade-out {
  opacity: 0;
  transform: translateX(450px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.notification.achievement-notif {
  border-color: #ffd700;
  background: linear-gradient(135deg, #3d3d1e, #2a2a1e);
}

.notification.upgrade-notif {
  border-color: #4CAF50;
  background: linear-gradient(135deg, #1e3d2d, #1e2a2a);
}

.notification.purchase-notif {
  border-color: #66BB6A;
  background: linear-gradient(135deg, #1e2a2a, #1e3d2d);
}

.notification.purchase-notif .notification-title {
  color: #66BB6A;
}

.notification.sell-notif {
  border-color: #ff6b6b;
  background: linear-gradient(135deg, #3d1e1e, #2a1e1e);
}

.notification.sell-notif .notification-title {
  color: #ff6b6b;
}

.notification-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #d4a574;
  line-height: 1.3;
}

.notification.achievement-notif .notification-title {
  color: #ffd700;
}

.notification.upgrade-notif .notification-title {
  color: #4CAF50;
}

.notification-message {
  font-size: 0.95rem;
  opacity: 0.9;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Settings */
.settings-content {
  max-height: 70vh;
  overflow-y: auto;
}

.setting-group {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-group:last-child {
  border-bottom: none;
}

.setting-group h3 {
  color: #d4a574;
  margin: 0 0 16px 0;
  font-size: 1.3rem;
}

.setting-item {
  margin-bottom: 16px;
}

.setting-item label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #f5f5f5;
}

.setting-description {
  font-size: 0.9rem;
  opacity: 0.7;
  margin: 8px 0;
  line-height: 1.4;
}

.setting-description.danger {
  color: #ff6b6b;
}

/* Toggle Container */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-container .toggle-text {
  font-size: 0.9rem;
  color: #f5f5f5;
  font-weight: 600;
}

/* Toggle Switches */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 0px;
  top: 50%;
  transform: translateY(-50%);
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #4CAF50;
}

input:checked + .toggle-slider:before {
  transform: translateY(-50%) translateX(34px);
}

.toggle-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  transition: color 0.4s;
}

input:checked + .toggle-slider .toggle-text:first-child {
  color: #666;
}

input:checked + .toggle-slider .toggle-text:last-child {
  color: #fff;
}

input:not(:checked) + .toggle-slider .toggle-text:first-child {
  color: #fff;
}

input:not(:checked) + .toggle-slider .toggle-text:last-child {
  color: #666;
}

/* Textarea for save import/export */
.setting-item textarea {
  width: 100%;
  min-height: 80px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  color: #f5f5f5;
  font-family: 'Comfortaa', sans-serif;
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.setting-item textarea:focus {
  outline: none;
  border-color: #d4a574;
}
