.decoder-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 1024px) {
  .decoder-layout {
    grid-template-columns: 1fr;
  }
}

.decoder-left,
.decoder-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-zone {
  border: 2px dashed #c9cdd4;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fafafa;
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-zone:hover {
  border-color: #165DFF;
  background: #f0f5ff;
}

.upload-zone.dragover {
  border-color: #165DFF;
  background: #e8f3ff;
  transform: scale(1.01);
}

.upload-content {
  pointer-events: none;
}

.upload-icon {
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.upload-title {
  font-size: 16px;
  font-weight: 600;
  color: #1d2129;
  margin-bottom: 8px;
}

.upload-subtitle {
  font-size: 14px;
  color: #4e5969;
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 12px;
  color: #86909c;
}

.image-preview-container {
  border: 2px solid #e5e6eb;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.preview-wrapper {
  position: relative;
  text-align: center;
  max-height: 400px;
  overflow: hidden;
  border-radius: 8px;
  background: #f7f8fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-wrapper img {
  max-width: 100%;
  max-height: 350px;
  object-fit: contain;
  border-radius: 4px;
}

.preview-info {
  margin-top: 12px;
  padding: 12px;
  background: #f7f8fa;
  border-radius: 6px;
  font-size: 13px;
  color: #4e5969;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.preview-info span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.preview-info .info-label {
  color: #86909c;
}

.panel-options {
  background: #fff;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px;
}

.option-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-item label {
  font-size: 14px;
  font-weight: 500;
  color: #4e5969;
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-item select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c9cdd4;
  border-radius: 6px;
  font-size: 14px;
  color: #1d2129;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-item select:focus {
  outline: none;
  border-color: #165DFF;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
}

.option-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.decoder-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.decoder-actions .btn-lg {
  flex: 1;
  min-width: 200px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
}

.results-container {
  min-height: 300px;
  position: relative;
}

.results-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #c9cdd4;
  width: 80%;
}

.results-empty svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.results-empty p {
  font-size: 14px;
  color: #86909c;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-card {
  background: #f7f8fa;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.result-card:hover {
  border-color: #165DFF;
  box-shadow: 0 2px 8px rgba(22, 93, 255, 0.08);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e6eb;
}

.result-format {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #e8f3ff;
  color: #165DFF;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.result-index {
  font-size: 12px;
  color: #86909c;
  font-weight: 500;
}

.result-content {
  background: #fff;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  word-break: break-all;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #1d2129;
  max-height: 150px;
  overflow-y: auto;
}

.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e6eb;
}

.meta-item {
  font-size: 12px;
  color: #4e5969;
}

.meta-label {
  color: #86909c;
  margin-right: 4px;
}

.panel-history {
  background: #fff;
  max-height: 250px;
  overflow-y: auto;
}

.history-list {
  padding: 16px;
}

.history-empty {
  text-align: center;
  color: #86909c;
  padding: 32px 0;
  font-size: 14px;
}

.history-item {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s ease;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background: #f7f8fa;
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.history-format {
  font-size: 13px;
  font-weight: 600;
  color: #165DFF;
}

.history-time {
  font-size: 11px;
  color: #86909c;
}

.history-content {
  font-size: 13px;
  color: #4e5969;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 12px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e6eb;
  border-top-color: #165DFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 14px;
  color: #4e5969;
  font-weight: 500;
}

.btn-tiny {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid #c9cdd4;
  background: #fff;
  color: #4e5969;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tiny:hover:not(:disabled) {
  border-color: #165DFF;
  color: #165DFF;
}

.btn-tiny:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .upload-zone {
    padding: 32px 16px;
    min-height: 200px;
  }

  .upload-icon svg {
    width: 48px;
    height: 48px;
  }

  .decoder-actions .btn-lg {
    min-width: auto;
    flex: 1 1 100%;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .result-meta {
    grid-template-columns: 1fr;
  }
}

.toast-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  z-index: 99999;
  pointer-events: none;
}

.toast {
  position: fixed !important;
  top: 80px !important;
  right: 20px !important;
  max-width: 400px;
  padding: 12px 20px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100000 !important;
  animation: toastSlideIn 0.3s ease forwards;
  pointer-events: auto;
}

.toast.toast-success { background: #00b42a; }
.toast.toast-error { background: #f53f3f; }
.toast.toast-warning { background: #ff7d00; }
.toast.toast-info { background: #165DFF; }

@keyframes toastSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}