/**
 * Screen Recorder Styles
 * UI for screen recording with GIF export
 */

/* Recorder Button - Fixed position */
.recorder-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #dc2626;
  color: #fff;
  border: 0;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  z-index: 2147483001;
  transition: all 0.2s;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.recorder-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.6);
}

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

.recorder-btn.recording {
  background: #16a34a;
  animation: recorderPulse 2s infinite;
}

@keyframes recorderPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Recorder Panel */
.recorder-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: #0b0b10;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 2147483001;
  display: none;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.recorder-panel.active {
  display: block;
  animation: recorderSlideIn 0.3s ease-out;
}

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

.recorder-panel h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 700;
  color: #e0e0e0;
}

/* Settings */
.recorder-setting {
  margin-bottom: 16px;
}

.recorder-setting label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.recorder-setting input[type="number"],
.recorder-setting input[type="range"] {
  width: 100%;
  padding: 8px;
  background: #191a23;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #e8e8ee;
  font-size: 13px;
}

.recorder-setting input[type="range"] {
  padding: 0;
  height: 32px;
  cursor: pointer;
}

.recorder-setting input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3498db;
  cursor: pointer;
  transition: all 0.2s;
}

.recorder-setting input[type="range"]::-webkit-slider-thumb:hover {
  background: #5dade2;
  transform: scale(1.1);
}

.recorder-setting input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3498db;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.recorder-setting input[type="range"]::-moz-range-thumb:hover {
  background: #5dade2;
  transform: scale(1.1);
}

/* Checkboxes */
.recorder-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.recorder-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #3498db;
}

.recorder-checkbox label {
  margin: 0;
  cursor: pointer;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  user-select: none;
}

/* Actions */
.recorder-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.recorder-actions .btn {
  flex: 1;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  background: #191a23;
  color: #ddd;
}

.recorder-actions .btn:hover {
  background: #2a2a2f;
  transform: translateY(-1px);
}

.recorder-actions .btn:active {
  transform: translateY(0);
}

.recorder-actions .btn-start {
  background: #16a34a;
  color: #fff;
}

.recorder-actions .btn-start:hover {
  background: #22c55e;
}

/* Status */
.recorder-status {
  margin-top: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  display: none;
}

.recorder-status.active {
  display: block;
}

#recStatusText {
  margin-bottom: 8px;
}

/* Progress Bar */
.recorder-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.recorder-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
  width: 0%;
  transition: width 0.3s ease-out;
  position: relative;
}

.recorder-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: recorderShimmer 1.5s infinite;
}

@keyframes recorderShimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .recorder-panel {
    right: 10px;
    left: 10px;
    bottom: 70px;
    width: auto;
  }
  
  .recorder-btn {
    right: 10px;
    bottom: 10px;
    padding: 10px 16px;
    font-size: 12px;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .recorder-btn {
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.5);
  }
  
  .recorder-panel {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
  }
}

/* Save Prompt Overlay */
.recorder-save-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 2147483002;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

.recorder-save-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.recorder-save-dialog {
  background: #1a1a1f;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  max-width: 500px;
  width: 90%;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.recorder-save-overlay.active .recorder-save-dialog {
  transform: scale(1);
}

.recorder-save-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.recorder-save-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.recorder-save-close {
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.recorder-save-close:hover {
  background: rgba(0, 0, 0, 0.4);
  transform: rotate(90deg);
}

.recorder-save-body {
  padding: 24px;
}

.recorder-save-preview {
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recorder-save-preview img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
}

.recorder-save-body > p {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  margin: 0 0 16px 0;
}

.recorder-save-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.recorder-save-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.recorder-save-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recorder-save-value {
  font-size: 16px;
  font-weight: 600;
  color: #22c55e;
}

.recorder-save-actions {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.recorder-save-actions .btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.recorder-save-download {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.recorder-save-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

.recorder-save-download:active {
  transform: translateY(0);
}

.recorder-save-cancel {
  background: #2a2a2f;
  color: #ddd;
}

.recorder-save-cancel:hover {
  background: #35353a;
}

/* Toast Notification */
.recorder-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1f;
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: 14px;
  font-weight: 500;
  z-index: 2147483003;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  border: 1px solid rgba(34, 197, 94, 0.3);
  background: linear-gradient(135deg, #1a1a1f 0%, #1e3a28 100%);
}

.recorder-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Mobile adjustments for save dialog */
@media (max-width: 768px) {
  .recorder-save-dialog {
    max-width: 95%;
  }
  
  .recorder-save-preview {
    max-height: 200px;
  }
  
  .recorder-save-info {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .recorder-save-stat {
    flex-direction: row;
    justify-content: space-between;
  }
  
  .recorder-save-actions {
    flex-direction: column;
  }
}

/* Mobile Preview Modal */
.mobile-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
  z-index: 2147483003;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

.mobile-preview-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-preview-dialog {
  background: #1a1a1f;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  max-width: 600px;
  width: 90%;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-preview-overlay.active .mobile-preview-dialog {
  transform: scale(1);
}

.mobile-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-preview-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.mobile-preview-close {
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mobile-preview-close:hover {
  background: rgba(0, 0, 0, 0.4);
  transform: rotate(90deg);
}

.mobile-preview-body {
  padding: 24px;
}

.mobile-preview-body > p {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  margin: 0 0 20px 0;
}

.mobile-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mobile-preset {
  background: linear-gradient(135deg, #2a2a2f 0%, #1a1a1f 100%);
  border: 2px solid rgba(155, 89, 182, 0.3);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.mobile-preset:hover {
  border-color: #9b59b6;
  background: linear-gradient(135deg, #3a3a3f 0%, #2a2a2f 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

.mobile-preset:active {
  transform: translateY(0);
}

.preset-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #9b59b6;
}

.preset-size {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Courier New', monospace;
}

/* Mobile preview responsive */
@media (max-width: 768px) {
  .mobile-preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .mobile-preset-grid {
    grid-template-columns: 1fr;
  }
}

