/* Custom Component Styles */

/* Panel Card Styling */
.panel-card {
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.panel-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -8px rgba(0, 0, 0, 0.1);
}

.panel-card.sortable-ghost {
  opacity: 0.5;
  transform: scale(0.95);
}

.panel-card.sortable-chosen {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Panel Collapse Styling */
.panel-card.panel-collapsed {
  margin-bottom: 0.5rem;
}

.panel-card.panel-collapsed .panel-content {
  display: none;
}

/* Panel content animasyonu için gerekli CSS */
.panel-content {
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  max-height: 2000px; /* Yeterince büyük bir değer */
  opacity: 1;
}

.panel-content.hidden {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.panel-card .collapse-panel {
  transition: all 0.2s ease;
}

.panel-card .collapse-panel:hover {
  background-color: rgba(156, 163, 175, 0.1);
}

/* Panel içindeki collapse icon animasyonları - DÜZELTİLDİ */
.panel-card .collapse-icon {
  transition: transform 0.3s ease;
  transform-origin: center;
  display: inline-block;
}

/* Panel Configuration yanındaki collapse all icon animasyonu - DÜZELTİLDİ */
#collapse-all-icon {
  transition: transform 0.3s ease;
  transform-origin: center;
  display: inline-block;
}

/* Animasyon durumları - DÜZELTME: 180 derece rotasyon yerine 0 ve 180 derece kullan */
.panel-card .collapse-icon.fa-chevron-up {
  transform: rotate(0deg);
}

.panel-card .collapse-icon.fa-chevron-down {
  transform: rotate(90deg);
}

#collapse-all-icon.fa-chevron-up {
  transform: rotate(0deg);
}

#collapse-all-icon.fa-chevron-down {
  transform: rotate(90deg);
}

/* Panel Preview Grid */
.terminal-preview-grid {
  display: grid;
  gap: 2px;
  height: 100%;
  min-height: 200px;
}

.terminal-panel {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border: 1px solid #374151;
  border-radius: 4px;
  padding: 8px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.dark .terminal-panel {
  background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
  border: 1px solid #475569;
}

.terminal-panel:hover {
  border-color: #6b7280;
}

.dark .terminal-panel:hover {
  border-color: #94a3b8;
}

.terminal-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--panel-color, #64748b);
}

.terminal-panel-title {
  font-size: 12px;
  color: #d1d5db;
  font-weight: 600;
  margin-bottom: 4px;
}

.dark .terminal-panel-title {
  color: #f1f5f9;
}

.terminal-panel-path {
  font-size: 10px;
  color: #9ca3af;
  font-family: 'Consolas', 'Monaco', monospace;
}

.dark .terminal-panel-path {
  color: #cbd5e1;
}

.terminal-panel-command {
  font-size: 10px;
  color: #10b981;
  font-family: 'Consolas', 'Monaco', monospace;
  margin-top: 8px;
  opacity: 0.8;
}

.dark .terminal-panel-command {
  color: #34d399;
}

/* Form Enhancements */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151;
}

.dark .form-label {
  color: #d1d5db;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background-color: #ffffff;
  transition: all 0.2s ease;
}

.dark .form-input {
  background-color: #1f2937;
  border-color: #4b5563;
  color: #f9fafb;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* Color Picker Grid */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-option.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--primary);
}

.color-option::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.color-option.selected::after {
  opacity: 1;
}

/* Custom Color Picker Styling */
.custom-color-wrapper {
  display: flex;
  flex-direction: column;
}

.custom-color-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.custom-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 0.5rem;
}

.custom-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 0.375rem;
}

.custom-color-input::-moz-color-swatch {
  border: none;
  border-radius: 0.375rem;
}

.custom-color-input:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.custom-color-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Range Slider Styling */
.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
  margin: 1rem 0;
}

.dark .range-slider {
  background: #4b5563;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Output Tab Styling */
.output-tab {
  border-bottom-color: transparent;
  color: #6b7280;
  transition: all 0.2s ease;
}

.output-tab:hover {
  color: #374151;
  border-bottom-color: #d1d5db;
}

.dark .output-tab:hover {
  color: #d1d5db;
  border-bottom-color: #4b5563;
}

.output-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

.slide-in {
  animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.scale-in {
  animation: scaleIn 0.2s ease-in-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Toast Notifications */
.toast {
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  min-width: 300px;
  max-width: 500px;
  animation: slideInRight 0.3s ease-out;
  position: relative;
  overflow: hidden;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success {
  background-color: #10b981;
  color: white;
}

.toast.error {
  background-color: #ef4444;
  color: white;
}

.toast.warning {
  background-color: #f59e0b;
  color: white;
}

.toast.info {
  background-color: var(--primary);
  color: white;
}

.toast-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
}

.toast-close:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Button Variants */
.btn-outline {
  border: 1px solid currentColor;
  background-color: transparent;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background-color: currentColor;
  color: white;
}

.btn-ghost {
  background-color: transparent;
  border: none;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark .btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Panel Size Display */
.size-display {
  font-family: 'Consolas', 'Monaco', monospace;
  font-weight: 600;
  color: var(--primary);
}

/* Directory Suggestions */
.directory-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
}

.dark .directory-suggestions {
  background: #1f2937;
  border-color: #4b5563;
}

.directory-suggestion {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
}

.dark .directory-suggestion {
  border-bottom-color: #374151;
}

.directory-suggestion:hover {
  background-color: #f9fafb;
}

.dark .directory-suggestion:hover {
  background-color: #374151;
}

.directory-suggestion:last-child {
  border-bottom: none;
}

/* Command Suggestions */
.command-suggestions {
  position: relative;
}

.command-suggestion-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-height: 150px;
  overflow-y: auto;
  z-index: 50;
}

.dark .command-suggestion-list {
  background: #1f2937;
  border-color: #4b5563;
}

.command-suggestion-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.875rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
}

.dark .command-suggestion-item {
  border-bottom-color: #374151;
}

.command-suggestion-item:hover {
  background-color: #f9fafb;
}

.dark .command-suggestion-item:hover {
  background-color: #374151;
}

.command-suggestion-item:last-child {
  border-bottom: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .panel-card {
    margin-bottom: 1rem;
  }

  .color-picker-grid {
    grid-template-columns: repeat(8, 1fr);
  }

  .terminal-preview-grid {
    min-height: 150px;
  }

  .toast {
    min-width: auto;
    margin: 0 1rem;
  }
}

@media (max-width: 640px) {
  .color-picker-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .form-input, .form-select, .form-textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Loading States */
.loading {
  position: relative;
  color: transparent !important;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #f3f4f6;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Focus States for Accessibility */
.focus-visible:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .panel-card {
    border-width: 2px;
    border-color: currentColor;
  }

  .form-input, .form-select, .form-textarea {
    border-width: 2px;
  }
}

/* Modal Animation Styles - FIXED */
#shortcuts-modal {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#shortcuts-modal.hidden {
  opacity: 0;
  visibility: hidden;
}

#shortcuts-modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

/* Modal içerik animasyonu */
#shortcuts-modal .modal-content {
  transition: none;
  /* Varsayılan durum: animasyon yokken görünür */
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Modal hidden durumunda içerik gizli */
#shortcuts-modal.hidden .modal-content {
  transform: scale(0.9) translateY(-20px);
  opacity: 0;
}

/* Açılma animasyonu */
#shortcuts-modal.modal-entering .modal-content {
  animation: modalFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Kapanma animasyonu */
#shortcuts-modal.modal-leaving .modal-content {
  animation: modalFadeOut 0.2s ease-out forwards;
}

/* Keyframe animasyonları */
@keyframes modalFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalFadeOut {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
}
