/**
 * Calculator Save System CSS
 * Styling för spara-till-projekt funktionalitet
 */

/* Spara-knapp sektion */
.save-to-project-section {
  margin-top: 30px;
  text-align: center;
  display: none; /* Döljs tills beräkning är klar */
}

.save-to-project-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 1rem 2.5rem;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.save-to-project-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
}

.save-to-project-btn:active {
  transform: translateY(-1px);
}

.save-to-project-btn i {
  font-size: 1.2rem;
}

/* Modal */
.save-calculation-modal {
  display: none !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  visibility: hidden;
}

.save-calculation-modal.active {
  display: flex !important;
  opacity: 1;
  visibility: visible;
}

.save-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.save-modal-content {
  position: relative;
  background: white;
  border-radius: 20px;
  max-width: 550px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Modal header */
.save-modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 20px 20px 0 0;
}

.save-modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.save-modal-header h3 i {
  color: #10b981;
  font-size: 1.4rem;
}

.save-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.save-modal-close:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: rotate(90deg);
}

.save-modal-close:active {
  transform: rotate(90deg) scale(0.9);
}

/* Modal body */
.save-modal-body {
  padding: 2rem;
}

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

.save-input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #334155;
  font-size: 0.95rem;
}

.save-input,
.save-select,
.save-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.3s;
  font-family: 'Inter', sans-serif;
  background: #f8fafc;
}

.save-input:focus,
.save-select:focus,
.save-textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  background: white;
}

.save-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Nya projekt-fält */
.new-project-fields {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  padding: 1.5rem;
  border-radius: 12px;
  margin-top: 1rem;
  border: 2px dashed #10b981;
  animation: expandIn 0.3s ease;
}

@keyframes expandIn {
  from {
    opacity: 0;
    max-height: 0;
    padding: 0 1.5rem;
  }
  to {
    opacity: 1;
    max-height: 500px;
    padding: 1.5rem;
  }
}

.new-project-fields .save-input-group {
  margin-bottom: 1rem;
}

.new-project-fields .save-input-group:last-child {
  margin-bottom: 0;
}

/* Sammanfattning */
.save-summary {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 1.25rem;
  border-radius: 12px;
  margin-top: 1.5rem;
  border: 2px solid #e2e8f0;
}

.save-summary h4 {
  color: #475569;
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  font-weight: 600;
}

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

.save-summary li {
  padding: 0.5rem 0;
  color: #64748b;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.save-summary li i {
  color: #10b981;
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* Modal footer */
.save-modal-footer {
  padding: 1.5rem 2rem;
  border-top: 2px solid #e2e8f0;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  background: #f8fafc;
  border-radius: 0 0 20px 20px;
}

.save-btn-primary,
.save-btn-secondary {
  padding: 0.875rem 1.75rem;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.save-btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.save-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.save-btn-primary:active {
  transform: translateY(0);
}

.save-btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.save-btn-secondary:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.save-btn-secondary:active {
  transform: scale(0.97);
}

/* Success toast */
.save-success-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  z-index: 10001;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.save-success-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.save-success-toast i {
  font-size: 1.3rem;
}

/* Responsivitet */
@media (max-width: 640px) {
  .save-modal-content {
    width: 95%;
    max-height: 95vh;
    border-radius: 16px;
  }

  .save-modal-header {
    padding: 1.25rem 1.5rem;
  }

  .save-modal-header h3 {
    font-size: 1.1rem;
  }

  .save-modal-body {
    padding: 1.5rem;
  }

  .save-modal-footer {
    padding: 1.25rem 1.5rem;
    flex-direction: column;
  }

  .save-btn-primary,
  .save-btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .save-to-project-btn {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  .save-success-toast {
    right: 10px;
    left: 10px;
    top: 10px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .save-modal-content {
    background: #1e293b;
    color: #e2e8f0;
  }

  .save-modal-header {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-bottom-color: #334155;
  }

  .save-modal-header h3 {
    color: #f1f5f9;
  }

  .save-modal-close {
    background: #334155;
    color: #94a3b8;
  }

  .save-modal-close:hover {
    background: #475569;
    color: #f1f5f9;
  }

  .save-input,
  .save-select,
  .save-textarea {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
  }

  .save-input:focus,
  .save-select:focus,
  .save-textarea:focus {
    background: #475569;
    border-color: #10b981;
  }

  .save-summary {
    background: #334155;
    border-color: #475569;
  }

  .save-summary h4 {
    color: #cbd5e1;
  }

  .save-summary li {
    color: #94a3b8;
  }

  .new-project-fields {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
  }

  .save-modal-footer {
    background: #334155;
    border-top-color: #475569;
  }

  .save-btn-secondary {
    background: #475569;
    color: #cbd5e1;
  }

  .save-btn-secondary:hover {
    background: #64748b;
    color: #f1f5f9;
  }
}
