/**
 * Share Modal Styles
 * Mobile-first responsive design
 */

/* Modal Overlay */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 16px;
}

.share-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.share-modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: linear-gradient(145deg, rgba(30, 30, 40, 0.95), rgba(20, 20, 30, 0.98));
  border: 1px solid rgba(74, 171, 194, 0.2);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: modalSlideIn 0.25s ease-out;
}

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

/* Mobile: 90% width max */
@media (max-width: 480px) {
  .share-modal {
    max-width: 90%;
    border-radius: 12px;
  }
  
  .share-modal-overlay {
    padding: 12px;
  }
}

/* Header */
.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.share-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.share-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Body */
.share-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Toggle Section */
.share-toggle-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.share-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.share-toggle-label {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
}

.share-toggle-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

/* Toggle Switch */
.share-toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

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

.share-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  transition: all 0.3s ease;
}

.share-toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.share-toggle input:checked + .share-toggle-slider {
  background: linear-gradient(135deg, #4AABC2, #6BC5D8);
}

.share-toggle input:checked + .share-toggle-slider::before {
  transform: translateX(24px);
}

.share-toggle input:disabled + .share-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Link Section */
.share-link-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.2s;
}

.share-link-section.inactive {
  opacity: 0.5;
}

.share-link-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.share-link-container {
  display: flex;
  gap: 8px;
}

.share-link-input {
  flex: 1;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  min-width: 0;
}

.share-link-input:focus {
  border-color: rgba(74, 171, 194, 0.5);
}

.share-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #4AABC2, #3A9BB2);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.share-copy-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #5BBCD3, #4AABC2);
  transform: translateY(-1px);
}

.share-copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-copy-btn.copied {
  background: linear-gradient(135deg, #4CAF50, #45a049);
}

.share-link-disabled-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin: 4px 0 0;
}

/* Visibility Section */
.share-visibility-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.share-visibility-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.share-visibility-options {
  display: flex;
  gap: 8px;
}

.visibility-option {
  flex: 1;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.visibility-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.visibility-option.active {
  background: rgba(74, 171, 194, 0.15);
  border-color: rgba(74, 171, 194, 0.4);
  color: #4AABC2;
}

.visibility-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

/* Footer */
.share-modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  justify-content: flex-end;
}

.share-done-btn {
  padding: 12px 32px;
  background: linear-gradient(135deg, #4AABC2, #3A9BB2);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.share-done-btn:hover {
  background: linear-gradient(135deg, #5BBCD3, #4AABC2);
  transform: translateY(-1px);
}

/* Loading Overlay */
.share-modal-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}

.share-modal-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #4AABC2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Mobile Adjustments */
@media (max-width: 480px) {
  .share-modal-header {
    padding: 16px 20px;
  }
  
  .share-modal-body {
    padding: 20px;
    gap: 20px;
  }
  
  .share-toggle-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .share-toggle {
    align-self: flex-end;
  }
  
  .share-visibility-options {
    flex-direction: column;
  }
  
  .share-link-container {
    flex-direction: column;
  }
  
  .share-copy-btn {
    justify-content: center;
  }
}

/* Safe Area for iPhone */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .share-modal-footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}
