/**
 * Attachment Calculator Stylesheet
 * Dark theme matching the original desktop application
 */

/* Calculator Container */
.calculator-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
}

/* Side-by-Side Layout */
.calculator-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.calculator-left {
  flex: 1 1 60%;
  min-width: 0;
}

.calculator-right {
  flex: 1 1 40%;
  position: sticky;
  top: 2rem;
  align-self: flex-start;
}

/* Header Section */
.calculator-header {
  background-color: #2e2e2e;
  padding: 1.5rem 2rem;
  border-radius: 12px 12px 0 0;
  text-align: center;
  margin-bottom: 0;
  border-bottom: 3px solid var(--accent);
}

.calculator-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.calculator-credit {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0;
}

.credit-name {
  color: #C8A2C8;
  font-weight: 600;
}

/* Attachment Grid */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  padding: 2rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px 12px 0 0;
}

.attachment-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

/* Attachment Icons */
.attachment-icon {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

/* Placeholder for attachments without images */
.attachment-icon[data-icon] {
  background: linear-gradient(135deg, var(--accent) 0%, #ff6b35 100%);
  position: relative;
  opacity: 0.8;
}

.attachment-icon[data-icon]::before {
  content: '📦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
}

.attachment-label-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.attachment-item label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-btn {
  background-color: transparent;
  border: 1px solid #C8A2C8;
  color: #C8A2C8;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 0.25rem;
}

.map-btn:hover {
  background-color: #C8A2C8;
  color: white;
  transform: scale(1.05);
}

.recipe-btn {
  background-color: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recipe-btn:hover {
  background-color: var(--accent);
  color: white;
  transform: scale(1.05);
}

.recipe-display {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  display: none;
  animation: slideDown 0.2s ease;
}

.recipe-display.active {
  display: block;
}

.recipe-display ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recipe-display li {
  padding: 0.15rem 0;
}

.recipe-display li::before {
  content: "• ";
  color: var(--accent);
  font-weight: bold;
  margin-right: 0.25rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.attachment-select {
  padding: 0.65rem 0.75rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.attachment-select:hover {
  border-color: var(--accent);
  background-color: var(--bg-hover);
}

.attachment-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Action Buttons */
.calculator-actions {
  display: flex;
  gap: 1rem;
  padding: 2rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 12px 12px;
  justify-content: center;
}

.calc-button {
  padding: 0.85rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calc-primary,
.calc-secondary {
  background-color: #555555;
  color: white;
}

.calc-primary:hover,
.calc-secondary:hover {
  background-color: #666666;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.calc-danger {
  background-color: #8B0000;
  color: white;
}

.calc-danger:hover {
  background-color: #A00000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 0, 0, 0.4);
}

.calc-button.flash-success {
  background-color: #4CAF50 !important;
  animation: flashPulse 0.5s ease;
}

@keyframes flashPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Results Section */
.calculator-results {
  background-color: #333333;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.calculator-results #copy-btn {
  margin-top: 1rem;
  width: 100%;
}

.results-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  text-align: center;
}

.results-content {
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.5;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 0.5rem;
  text-align: center;
  flex: 1;
}

.results-content:empty::before {
  content: "Select attachments and click Calculate to see materials needed.";
  color: var(--text-secondary);
  font-style: italic;
}

.results-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.results-content li {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.results-content li:last-child {
  border-bottom: none;
}

.results-content li::before {
  content: "• ";
  color: var(--accent);
  font-weight: bold;
  margin-right: 0.5rem;
}

/* Raw Material Inline Display */
.raw-material-inline {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9em;
  margin-left: 0.25rem;
}

/* Raw Materials Summary Section */
.raw-materials-summary {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px solid var(--accent);
}

.raw-summary-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.raw-summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.raw-summary-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-weight: 600;
  color: var(--text-primary);
}

.raw-summary-list li:last-child {
  border-bottom: none;
}

.raw-summary-list li::before {
  content: "▶ ";
  color: var(--accent);
  font-weight: bold;
  margin-right: 0.5rem;
}

/* Scrollbar Styling */
.results-content::-webkit-scrollbar {
  width: 8px;
}

.results-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.results-content::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.results-content::-webkit-scrollbar-thumb:hover {
  background: #ff8255;
}

/* Map Modal */
.map-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.85);
  animation: fadeIn 0.3s ease;
}

.map-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.map-modal-content {
  background-color: var(--bg-secondary);
  border: 2px solid #C8A2C8;
  border-radius: 12px;
  padding: 2rem;
  max-width: 90%;
  max-height: 90%;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

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

.map-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
  color: #C8A2C8;
  cursor: pointer;
  transition: all 0.2s ease;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.map-modal-close:hover {
  color: white;
  transform: scale(1.2);
}

.map-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #C8A2C8;
  margin: 0 0 1.5rem 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 1rem;
  border-bottom: 2px solid #C8A2C8;
}

.map-modal-image-container {
  max-width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.map-modal-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  display: none;
}

.map-modal-image.visible {
  display: block;
}

.map-placeholder {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.map-placeholder p {
  font-size: 1.25rem;
  margin: 0.5rem 0;
}

.map-placeholder .map-placeholder-small {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-tertiary);
  margin-top: 1rem;
}

.map-placeholder.hidden {
  display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .calculator-container {
    padding: 1rem;
  }

  /* Stack layout vertically on tablets */
  .calculator-layout {
    flex-direction: column;
  }

  .calculator-left,
  .calculator-right {
    flex: 1 1 100%;
  }

  .calculator-right {
    position: static;
  }

  .attachment-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem;
  }

  .calculator-header {
    padding: 1.25rem 1.5rem;
  }

  .calculator-title {
    font-size: 1.5rem;
  }

  .calculator-actions {
    flex-direction: column;
    padding: 1.5rem;
  }

  .calc-button {
    width: 100%;
    padding: 0.75rem 1.5rem;
  }

  .calculator-results {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .attachment-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    padding: 1.25rem;
  }

  .calculator-header {
    padding: 1rem;
  }

  .calculator-title {
    font-size: 1.25rem;
  }

  .calculator-credit {
    font-size: 0.85rem;
  }

  .attachment-item label {
    font-size: 0.85rem;
  }

  .attachment-select {
    padding: 0.6rem;
    font-size: 0.95rem;
  }

  .calc-button {
    padding: 0.7rem 1.25rem;
    font-size: 0.95rem;
  }

  .calculator-results {
    padding: 1.25rem;
  }

  .results-title {
    font-size: 1.1rem;
  }

  .results-content {
    font-size: 0.9rem;
  }
}
