/**
 * Save System Styles
 * Modern, responsive UI for save management
 */

/* Floating Save Button */
.floating-save-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-save-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(102, 126, 234, 0.7);
}

.floating-save-btn:active {
  transform: scale(0.95);
}

/* Modal */
.save-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

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

.save-modal-content {
  position: relative;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  margin: 3% auto;
  padding: 0;
  border: 2px solid #00ff41;
  border-radius: 16px;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

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

/* Modal Header */
.save-modal-header {
  background: rgba(0, 255, 65, 0.1);
  padding: 20px 30px;
  border-bottom: 2px solid #00ff41;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.save-modal-header h2 {
  margin: 0;
  color: #00ff41;
  font-size: 24px;
}

.close-btn {
  background: none;
  border: none;
  color: #00ff41;
  font-size: 36px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-btn:hover {
  background: rgba(255, 0, 0, 0.2);
  color: #ff4757;
  transform: rotate(90deg);
}

/* Tabs */
.save-modal-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid rgba(0, 255, 65, 0.2);
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  padding: 15px 20px;
  background: transparent;
  border: none;
  color: rgba(0, 255, 65, 0.6);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(0, 255, 65, 0.1);
  color: #00ff41;
}

.tab-btn.active {
  color: #00ff41;
  border-bottom-color: #00ff41;
  background: rgba(0, 255, 65, 0.05);
}

/* Tab Content */
.tab-content {
  display: none;
  padding: 30px;
  max-height: calc(85vh - 200px);
  overflow-y: auto;
}

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

/* Custom Scrollbar */
.tab-content::-webkit-scrollbar {
  width: 8px;
}

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

.tab-content::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 65, 0.3);
  border-radius: 4px;
}

.tab-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 65, 0.5);
}

/* Save Slots */
.save-slots-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.save-slot {
  background: rgba(0, 255, 65, 0.05);
  border: 2px solid rgba(0, 255, 65, 0.3);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
}

.save-slot:hover {
  border-color: #00ff41;
  transform: translateY(-2px);
}

.save-slot.current {
  border-color: #ffd700;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.save-slot.empty {
  border-style: dashed;
  opacity: 0.7;
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 255, 65, 0.2);
}

.slot-number {
  font-weight: bold;
  color: #00ff41;
  font-size: 18px;
}

.slot-status {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  text-transform: uppercase;
}

.slot-badge {
  background: #ffd700;
  color: #000;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}

.slot-body {
  margin: 15px 0;
  min-height: 100px;
}

.save-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.info-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.info-value {
  color: #00ff41;
  font-weight: bold;
  font-size: 14px;
}

.empty-message {
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
  margin: 30px 0;
}

.slot-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.slot-actions .btn {
  flex: 1;
  min-width: 80px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: 2px solid;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.btn-primary {
  background: rgba(0, 255, 65, 0.1);
  border-color: #00ff41;
  color: #00ff41;
}

.btn-primary:hover {
  background: #00ff41;
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 255, 65, 0.4);
}

.btn-success {
  background: rgba(72, 187, 120, 0.1);
  border-color: #48bb78;
  color: #48bb78;
}

.btn-success:hover {
  background: #48bb78;
  color: #fff;
  box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.btn-danger {
  background: rgba(255, 71, 87, 0.1);
  border-color: #ff4757;
  color: #ff4757;
}

.btn-danger:hover {
  background: #ff4757;
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.save-actions {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid rgba(0, 255, 65, 0.2);
}

/* Time Travel / History */
.time-travel-info {
  background: rgba(255, 193, 7, 0.1);
  border: 2px solid rgba(255, 193, 7, 0.5);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  color: #ffc107;
}

.time-travel-info p {
  margin: 5px 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: rgba(0, 255, 65, 0.05);
  border: 2px solid rgba(0, 255, 65, 0.2);
  border-radius: 8px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.history-item:hover {
  border-color: #00ff41;
  background: rgba(0, 255, 65, 0.1);
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.history-turn {
  color: #00ff41;
  font-weight: bold;
  font-size: 16px;
}

.history-date {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.no-history {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.5);
}

.no-history p:first-child {
  font-size: 48px;
  margin-bottom: 10px;
}

/* Import/Export */
.import-export-section {
  max-width: 600px;
  margin: 0 auto;
}

.import-export-section h3 {
  color: #00ff41;
  margin: 20px 0 10px;
}

.import-export-section p {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 15px;
}

.import-export-section hr {
  border: none;
  border-top: 2px solid rgba(0, 255, 65, 0.2);
  margin: 30px 0;
}

.export-slots {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.export-slots .btn {
  flex: 1;
  min-width: 150px;
}

.import-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.import-section input[type="file"] {
  padding: 10px;
  background: rgba(0, 255, 65, 0.05);
  border: 2px solid rgba(0, 255, 65, 0.3);
  border-radius: 8px;
  color: #00ff41;
  cursor: pointer;
}

.import-section select {
  padding: 10px;
  background: rgba(0, 255, 65, 0.05);
  border: 2px solid rgba(0, 255, 65, 0.3);
  border-radius: 8px;
  color: #00ff41;
  cursor: pointer;
}

.import-section label {
  color: rgba(255, 255, 255, 0.8);
}

/* Settings */
.settings-section {
  max-width: 600px;
  margin: 0 auto;
}

.settings-section h3 {
  color: #00ff41;
  margin: 20px 0;
}

.setting-item {
  background: rgba(0, 255, 65, 0.05);
  border: 2px solid rgba(0, 255, 65, 0.2);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.setting-item label {
  color: #00ff41;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.setting-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #00ff41;
}

.setting-item input[type="number"] {
  width: 80px;
  padding: 8px;
  background: rgba(0, 255, 65, 0.05);
  border: 2px solid rgba(0, 255, 65, 0.3);
  border-radius: 4px;
  color: #00ff41;
  text-align: center;
  margin: 0 10px;
}

.setting-description {
  margin: 8px 0 0 30px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-style: italic;
}

/* Storage Info */
.storage-info {
  background: rgba(0, 255, 65, 0.05);
  border: 2px solid rgba(0, 255, 65, 0.2);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.storage-stat {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
}

.stat-label {
  color: rgba(255, 255, 255, 0.7);
}

.stat-value {
  color: #00ff41;
  font-weight: bold;
}

.storage-bar {
  width: 100%;
  height: 30px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  overflow: hidden;
  margin: 15px 0;
  position: relative;
}

.storage-bar-fill {
  height: 100%;
  background: #48bb78;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  transition: width 0.5s ease;
}

.storage-note {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .save-modal-content {
    width: 95%;
    margin: 5% auto;
    max-height: 90vh;
  }
  
  .save-modal-header {
    padding: 15px 20px;
  }
  
  .save-modal-header h2 {
    font-size: 20px;
  }
  
  .tab-content {
    padding: 20px;
  }
  
  .save-slots-container {
    grid-template-columns: 1fr;
  }
  
  .slot-actions {
    flex-direction: column;
  }
  
  .slot-actions .btn {
    width: 100%;
  }
  
  .export-slots {
    flex-direction: column;
  }
  
  .floating-save-btn {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .save-modal-tabs {
    font-size: 12px;
  }
  
  .tab-btn {
    padding: 12px 10px;
  }
  
  .save-modal-header h2 {
    font-size: 18px;
  }
  
  .history-item {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .history-item .btn {
    width: 100%;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode adjustments (if needed) */
@media (prefers-color-scheme: dark) {
  .save-modal-content {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
  }
}
