/* OIO Subtitle Studio - Modern Cinematic Theme */
.oio-sub-app-wrapper {
  --oio-bg: #141414;
  --oio-surface: #1f1f1f;
  --oio-surface-hover: #2a2a2a;
  --oio-primary: #e50914;
  --oio-primary-hover: #f40612;
  --oio-text: #ffffff;
  --oio-text-muted: #a3a3a3;
  --oio-border: #333333;
  --oio-radius: 12px;
  --oio-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);

  font-family: 'Inter', sans-serif;
  color: var(--oio-text);
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

/* Modal Overlay */
.oio-sub-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 20px;
}

.oio-sub-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.oio-sub-modal-content {
  position: relative;
  width: 100%;
  max-width: 800px;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.oio-sub-modal-overlay.active .oio-sub-modal-content {
  transform: scale(1);
}

.oio-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  font-size: 30px;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 5px;
  transition: color 0.2s;
}

.oio-modal-close:hover {
  color: var(--oio-primary);
}

.oio-sub-app {
  background: var(--oio-surface);
  border: 1px solid var(--oio-border);
  border-radius: var(--oio-radius);
  padding: 40px;
  box-shadow: var(--oio-shadow);
  position: relative;
  overflow: hidden;
}

/* Header */
.oio-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 35px;
}

.oio-icon-badge {
  background: linear-gradient(135deg, var(--oio-primary), #b20710);
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(229, 9, 20, 0.3);
  flex-shrink: 0;
}

.oio-icon-badge svg {
  color: white;
  width: 26px;
  height: 26px;
}

.oio-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px 0;
  background: linear-gradient(to right, #fff, #bbb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.oio-subtitle {
  margin: 0;
  color: var(--oio-text-muted);
  font-size: 15px;
  line-height: 1.5;
}

/* Drop Zone */
.oio-drop-zone {
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed var(--oio-border);
  border-radius: var(--oio-radius);
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  margin-bottom: 25px;
}

.oio-drop-zone:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--oio-primary);
}

.oio-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.oio-drop-content {
  pointer-events: none;
}

.oio-cloud-icon {
  color: var(--oio-text-muted);
  margin-bottom: 15px;
  transition: color 0.3s ease;
}

.oio-drop-zone:hover .oio-cloud-icon {
  color: var(--oio-primary);
}

#oioFileName {
  display: block;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
}

.oio-file-hint {
  display: block;
  font-size: 13px;
  color: var(--oio-text-muted);
}

/* Controls */
.oio-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.oio-control-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  color: var(--oio-text-muted);
}

.oio-select-wrapper {
  position: relative;
}

.oio-select {
  width: 100%;
  appearance: none;
  background: var(--oio-surface-hover);
  border: 1px solid var(--oio-border);
  border-radius: 8px;
  padding: 12px 15px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s;
}

.oio-select:focus {
  outline: none;
  border-color: var(--oio-primary);
}

.oio-chevron {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--oio-text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.oio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  height: 46px;
}

.oio-btn-primary {
  background: var(--oio-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
}

.oio-btn-primary:hover {
  background: var(--oio-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(229, 9, 20, 0.5);
}

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

.oio-btn-ghost {
  background: transparent;
  border: 1px solid var(--oio-border);
  color: var(--oio-text-muted);
}

.oio-btn-ghost:hover:not(:disabled) {
  border-color: var(--oio-text);
  color: var(--oio-text);
  background: rgba(255, 255, 255, 0.05);
}

.oio-btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status & Table */
.oio-status {
  margin-top: 20px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  min-height: 20px;
  color: #4ade80;
  /* Success green */
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .oio-sub-app {
    padding: 25px;
  }

  .oio-controls {
    grid-template-columns: 1fr;
  }
}

/* --- Fixed Table Styling --- */
.oio-table-wrap {
  margin-top: 25px;
  border: 1px solid var(--oio-border);
  border-radius: 12px;
  overflow: hidden;
  display: none;
  max-height: 450px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.oio-table-wrap:not(:empty) {
  display: block;
}

/* Custom Scrollbar */
.oio-table-wrap::-webkit-scrollbar {
  width: 6px;
}

.oio-table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.oio-table-wrap::-webkit-scrollbar-thumb {
  background: var(--oio-border);
  border-radius: 3px;
}

.oio-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--oio-primary);
}

.oio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.oio-table th {
  background: #1f1f1f;
  color: #a3a3a3;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-align: left;
  padding: 15px;
  border-bottom: 2px solid var(--oio-border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.oio-table td {
  padding: 10px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}

.oio-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Input & Textarea Styling */
.oio-input,
.oio-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px 10px;
  color: #e0e0e0;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: all 0.2s ease;
}

.oio-textarea {
  min-height: 60px;
  resize: vertical;
  line-height: 1.5;
}

.oio-input:focus,
.oio-textarea:focus {
  background: rgba(0, 0, 0, 0.5);
  border-color: var(--oio-primary);
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.2);
  outline: none;
  color: #fff;
}

/* Specific Column Widths */
.oio-table td:first-child {
  width: 50px;
  text-align: center;
  color: #666;
  padding-top: 18px;
}

.oio-table td:nth-child(2),
.oio-table td:nth-child(3) {
  width: 110px;
}

/* Translating Loading Moment CSS */
.oio-translating-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 15px auto;
  max-width: 500px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.3s ease;
  text-align: left;
}

.oio-translating-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.oio-status-dot {
  width: 10px;
  height: 10px;
  background-color: var(--oio-primary);
  border-radius: 50%;
  position: relative;
}

.oio-status-dot.pulse-glow {
  animation: pulseGlow 1.5s infinite ease-in-out;
  box-shadow: 0 0 0 0 rgba(229, 9, 20, 0.7);
}

@keyframes pulseGlow {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(229, 9, 20, 0.7);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(229, 9, 20, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(229, 9, 20, 0);
  }
}

.oio-translating-text {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.2px;
}

.oio-translating-percent {
  margin-left: auto;
  font-size: 14px;
  font-weight: 700;
  color: var(--oio-primary);
}

.oio-progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.oio-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--oio-primary), #ff4d4d);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(229, 9, 20, 0.5);
}

/* English Cues Queue Widget & Modal */
.oio-english-queue-banner {
  animation: fadeInDown 0.3s ease;
}

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

.oio-queue-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.2s, border-color 0.2s;
}

.oio-queue-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(249, 115, 22, 0.3);
}

.oio-queue-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #888;
}

.oio-queue-item-badge {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 11px;
}

.oio-queue-item-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 13px;
}

@media (max-width: 600px) {
  .oio-queue-item-body {
    grid-template-columns: 1fr;
  }
}

.oio-queue-text-orig {
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
  line-height: 1.4;
}

.oio-queue-text-trans {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid #ef4444;
  line-height: 1.4;
}