/* PRESET STYLES */

/* Preset Card */
.preset-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  margin: 1rem 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid #e2e8f0;
  position: relative;
}

.preset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.preset-card .preset-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a365d;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #4299e1;
  text-transform: capitalize;
}

.card-previews {
  display: flex;
  gap: 8px;
  margin: 0.5rem 0;
  overflow-x: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  background: #f7fafc;
  border-radius: 8px;
  padding: 1rem;
}

.card-previews::-webkit-scrollbar {
  height: 4px;
}

.card-previews::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.card-previews::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 2px;
}

.card-thumbnail {
  width: 60px;
  height: 84px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
  cursor: pointer;
  border: 2px solid white;
}

.card-thumbnail:hover {
  transform: scale(1.15);
  z-index: 1;
}

.preset-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  font-size: 1rem;
  color: #4a5568;
  background: #f7fafc;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.preset-cost {
  color: #2c5282;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preset-cost::before {
  content: "💰";
}

.preset-winrate {
  color: #2f855a;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preset-winrate::before {
  content: "📈";
}

.preset-controls {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  align-self: center;
}

/* Modal Base Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.modal-overlay.closing {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Ensure all modal types have consistent base styling */
.preset-modal {
  background: white;
  border-radius: 12px;
  width: min(90vw, 800px);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(20px);
  opacity: 0;
  animation: slideIn 0.3s ease forwards;
}

.preset-modal.copy-rentals-modal {
  padding: 0;
  overflow: hidden;
}

.preset-modal.copy-rentals-modal .modal-body {
  max-height: 70vh;
  overflow-y: auto;
  padding: 0;
}

.closing .preset-modal {
  animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(20px);
    opacity: 0;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: white;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: #718096;
  transition: color 0.2s ease;
  line-height: 1;
}

.close-modal:hover {
  color: #2d3748;
}

.modal-body {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  background: white;
  border-top: 1px solid #e2e8f0;
}

.btn-primary {
  background: #4299e1;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  background: #3182ce;
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-secondary {
  background: #e2e8f0;
  color: #4a5568;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #cbd5e0;
  color: #2d3748;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #2d3748;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* Buttons */
.btn-apply,
.btn-edit,
.btn-delete,
.btn-confirm,
.btn-cancel {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 100px;
  justify-content: center;
}

.btn-apply {
  background-color: #4CAF50;
  color: white;
}

.btn-apply:hover {
  background-color: #45a049;
  transform: translateY(-1px);
}

.btn-edit {
  background-color: #4299e1;
  color: white;
}

.btn-edit:hover {
  background-color: #3182ce;
  transform: translateY(-1px);
}

.btn-delete {
  background-color: #f56565;
  color: white;
}

.btn-delete:hover {
  background-color: #e53e3e;
  transform: translateY(-1px);
}

/* Alert Messages */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-error {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.alert-success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

/* Grid Layout */
.preset-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  padding: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .preset-card {
    margin: 0.25rem;
  }
  
  .card-thumbnail {
    width: 40px;
    height: 56px;
  }
  
  .preset-controls {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .btn-apply,
  .btn-edit,
  .btn-delete {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .preset-modal {
    width: 95vw;
    padding: 1rem;
  }
}

/* Preset Manager Locked State */
.preset-manager.locked {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  margin: 1rem 0;
}

.preset-locked-message {
  text-align: center;
  color: #666;
  padding: 2rem;
}

.lock-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

/* Create Preset Button */
.btn-new-preset {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-new-preset:hover:not(:disabled) {
  background-color: #45a049;
}

.btn-new-preset:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-new-preset i {
  margin-right: 0.5rem;
}

/* Card Selector and Price Display */
.card-selector-item {
  position: relative;
  margin: 4px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.card-selector-item:hover {
  transform: scale(1.05);
}

.card-preview-container {
  position: relative;
  display: inline-block;
}

.card-price {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  z-index: 2;
}

.price-summary {
  padding: 1rem;
  background: #edf2f7;
  border-radius: 8px;
  margin: 1rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.individual-costs {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.card-cost {
  display: flex;
  justify-content: space-between;
  margin: 0.3rem 0;
  padding: 0.2rem 0;
  border-bottom: 1px solid #cbd5e0;
  font-size: 0.9em;
}

.total-cost {
  font-weight: bold;
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 2px solid #2a4365;
  text-align: right;
  font-size: 1.1em;
  color: #2a4365;
}

/* Price Calculator Styles */
.price-display {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.price-summary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.individual-costs {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.individual-costs::-webkit-scrollbar {
  width: 4px;
}

.individual-costs::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.individual-costs::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 2px;
}

.card-cost {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: #4a5568;
}

.card-cost:not(:last-child) {
  border-bottom: 1px dashed #e2e8f0;
}

.card-cost span:first-child {
  font-weight: 500;
}

.card-cost span:last-child {
  color: #2c5282;
  font-family: monospace;
}

.total-cost {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
  text-align: right;
  padding-top: 0.5rem;
  border-top: 2px solid #4299e1;
}

/* Loading State */
.price-display.loading {
  opacity: 0.7;
  pointer-events: none;
}

.price-display.loading::after {
  content: "Loading prices...";
  display: block;
  text-align: center;
  color: #4a5568;
  font-style: italic;
  margin-top: 0.5rem;
}

/* Error State */
.price-display.error {
  border: 1px solid #feb2b2;
  background: #fff5f5;
}

.price-display.error::after {
  content: "Error loading prices. Please try again.";
  display: block;
  text-align: center;
  color: #c53030;
  font-weight: 500;
  margin-top: 0.5rem;
}

/* Card Selection Modal Styles */
.card-item {
  position: relative;
  background: white;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-item.selected {
  border: 2px solid #4299e1;
  box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}

.card-preview-container {
  position: relative;
  display: inline-block;
  width: 100%;
  margin-bottom: 8px;
}

.card-preview-container img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.card-price {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 2;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-name {
  font-weight: 500;
  color: #2d3748;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rental-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-level {
  padding: 2px 4px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: white;
  font-size: 0.875rem;
  color: #4a5568;
}

/* Creation Choice Modal */
.creation-choice-modal {
  min-width: 500px;
  max-width: 90vw;
}

.creation-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.choice-card {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.choice-card:hover {
  border-color: #4299e1;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(66,153,225,0.1);
}

.choice-icon {
  font-size: 2rem;
  margin-right: 1.5rem;
  flex-shrink: 0;
  color: #4299e1;
}

.choice-details {
  flex: 1;
}

.choice-details h4 {
  margin: 0 0 0.25rem;
  color: #2d3748;
  font-size: 1.1rem;
}

.choice-details p {
  margin: 0;
  color: #718096;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 640px) {
  .creation-choice-modal {
    width: 100%;
    margin: 1rem;
    min-width: 0;
  }

  .choice-card {
    padding: 1rem;
  }

  .choice-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
  }

  .choice-details h4 {
    font-size: 1rem;
  }

  .choice-details p {
    font-size: 0.85rem;
  }
}

/* Shared Modal Styles */
.modal-overlay.active {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
  margin: 0;
  color: #2d3748;
}

.close-modal {
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  color: #718096;
  background: none;
  border: none;
  padding: 0.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #4a5568;
}

.input-group input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-primary {
  background: #4299e1;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background: #3182ce;
}

.btn-secondary {
  background: #e2e8f0;
  color: #4a5568;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #cbd5e0;
  color: #2d3748;
}

/* Rental Review Modal Styles */
.rental-review-container {
  padding: 1.5rem;
  background: white;
  border-radius: 8px;
}

.excluded-section {
  padding: 1.5rem;
  background: #f7fafc;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.excluded-tabs {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 1rem;
  background: white;
}

.tab-headers {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
}

.tab-header {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #4a5568;
  border-right: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  flex: 1;
  text-align: center;
}

.tab-header:last-child {
  border-right: none;
}

.tab-header:hover {
  background: #f7fafc;
}

.tab-header.active {
  background: #ebf8ff;
  color: #2b6cb0;
  font-weight: 500;
}

.tab-content {
  background: white;
  padding: 1rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.rentals-section {
  margin-top: 1.5rem;
}

.rentals-grid h3 {
  color: #2d3748;
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.card-item {
  background: white;
  border-radius: 6px;
  padding: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-item img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  aspect-ratio: 5/7;
  object-fit: cover;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-name {
  font-weight: 500;
  color: #2d3748;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rental-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.rental-price {
  color: #2c5282;
  font-weight: 500;
}

.card-level {
  color: #4a5568;
  background: #f7fafc;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  font-size: 0.7rem;
}

.total-dec-cost {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f7fafc;
  border-radius: 6px;
  text-align: right;
  font-weight: 600;
  color: #2d3748;
  border-top: 2px solid #4299e1;
  font-size: 0.9rem;
}

.no-rentals {
  text-align: center;
  padding: 1.5rem;
  color: #718096;
  font-style: italic;
  background: #f7fafc;
  border-radius: 6px;
  margin: 1rem 0;
  border: 1px solid #e2e8f0;
  font-size: 0.9rem;
}

/* Ensure modal is always on top */
#rentalReviewOverlay {
    z-index: 9999 !important;
}

#rentalReviewOverlay .preset-modal {
    z-index: 10000 !important;
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .card-item {
    padding: 0.35rem;
  }
  
  .card-name {
    font-size: 0.75rem;
  }
  
  .rental-meta {
    font-size: 0.7rem;
  }
  
  .tab-header {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
} 