/**
 * Taranagar PDF Tools Stylesheet
 * 100% Mobile-first, Responsive, Dark/Light Mode compatible, 44px+ Touch Targets
 */

:root {
  --tpt-primary: #0056b3;
  --tpt-primary-hover: #004085;
  --tpt-accent: #f59e0b;
  --tpt-success: #10b981;
  --tpt-danger: #ef4444;
  --tpt-bg-card: #ffffff;
  --tpt-bg-subtle: #f8fafc;
  --tpt-border: #cbd5e1;
  --tpt-text: #1e293b;
  --tpt-text-muted: #64748b;
  --tpt-radius: 12px;
  --tpt-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .taranagar-tool-card,
.dark-theme .taranagar-tool-card {
  --tpt-primary: #3b82f6;
  --tpt-primary-hover: #2563eb;
  --tpt-bg-card: #1e293b;
  --tpt-bg-subtle: #0f172a;
  --tpt-border: #334155;
  --tpt-text: #f8fafc;
  --tpt-text-muted: #94a3b8;
  --tpt-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Main Tool Container */
.taranagar-tool-card {
  background: var(--tpt-bg-card);
  border: 1px solid var(--tpt-border);
  border-radius: var(--tpt-radius);
  box-shadow: var(--tpt-shadow);
  padding: 24px;
  margin: 20px 0 35px;
  color: var(--tpt-text);
  font-family: inherit;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

@media (max-width: 600px) {
  .taranagar-tool-card {
    padding: 16px;
    border-radius: 8px;
  }
}

/* Security Banner */
.tpt-security-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 22px;
}
[data-theme="dark"] .tpt-security-badge,
.dark-theme .tpt-security-badge {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* Drop Zone */
.tpt-dropzone {
  border: 2px dashed var(--tpt-primary);
  border-radius: var(--tpt-radius);
  background: var(--tpt-bg-subtle);
  padding: 35px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tpt-dropzone:hover,
.tpt-dropzone.dragover {
  background: rgba(0, 86, 179, 0.06);
  border-color: var(--tpt-accent);
  transform: scale(1.005);
}

.tpt-drop-icon {
  font-size: 44px;
  margin-bottom: 10px;
  line-height: 1;
}

.tpt-drop-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--tpt-text);
}

.tpt-drop-hint {
  font-size: 0.9rem;
  color: var(--tpt-text-muted);
  margin-bottom: 15px;
}

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

/* Buttons */
.tpt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 24px;
  min-height: 46px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tpt-btn:focus-visible {
  outline: 3px solid var(--tpt-accent);
  outline-offset: 2px;
}

.tpt-btn-primary {
  background: var(--tpt-primary);
  color: #ffffff !important;
}
.tpt-btn-primary:hover:not(:disabled) {
  background: var(--tpt-primary-hover);
  transform: translateY(-1px);
}

.tpt-btn-success {
  background: var(--tpt-success);
  color: #ffffff !important;
}
.tpt-btn-success:hover:not(:disabled) {
  background: #059669;
}

.tpt-btn-danger {
  background: var(--tpt-danger);
  color: #ffffff !important;
}
.tpt-btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.tpt-btn-outline {
  background: transparent;
  border: 1px solid var(--tpt-border);
  color: var(--tpt-text);
}
.tpt-btn-outline:hover:not(:disabled) {
  background: var(--tpt-bg-subtle);
  border-color: var(--tpt-primary);
}

.tpt-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Toolbar & Limits Info */
.tpt-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 20px 0 15px;
  padding: 10px 14px;
  background: var(--tpt-bg-subtle);
  border-radius: 8px;
}

.tpt-count-badge {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Items Preview Grid */
.tpt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 25px;
}

@media (max-width: 480px) {
  .tpt-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.tpt-card-item {
  background: var(--tpt-bg-card);
  border: 1px solid var(--tpt-border);
  border-radius: 8px;
  padding: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tpt-card-item.dragging {
  opacity: 0.4;
  border: 2px dashed var(--tpt-primary);
}

.tpt-card-thumb-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

[data-theme="dark"] .tpt-card-thumb-wrap,
.dark-theme .tpt-card-thumb-wrap {
  background: #0f172a;
}

.tpt-card-thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.tpt-card-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.tpt-card-meta {
  padding: 6px 2px 2px;
  font-size: 0.8rem;
  color: var(--tpt-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Action Controls (min 44px touch) */
.tpt-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  justify-content: space-between;
}

.tpt-action-btn {
  flex: 1;
  min-height: 38px;
  min-width: 38px;
  padding: 4px;
  background: var(--tpt-bg-subtle);
  border: 1px solid var(--tpt-border);
  border-radius: 6px;
  color: var(--tpt-text);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.tpt-action-btn:hover {
  background: #e2e8f0;
  border-color: var(--tpt-primary);
}
[data-theme="dark"] .tpt-action-btn:hover,
.dark-theme .tpt-action-btn:hover {
  background: #334155;
}

.tpt-action-btn.btn-delete:hover {
  background: #fee2e2;
  color: var(--tpt-danger);
  border-color: var(--tpt-danger);
}

/* Settings Form Panel */
.tpt-settings-box {
  background: var(--tpt-bg-subtle);
  border: 1px solid var(--tpt-border);
  border-radius: 10px;
  padding: 20px;
  margin: 20px 0;
}

.tpt-settings-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tpt-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.tpt-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tpt-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--tpt-text);
}

.tpt-select,
.tpt-input {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--tpt-border);
  border-radius: 6px;
  background: var(--tpt-bg-card);
  color: var(--tpt-text);
  font-size: 0.95rem;
}

.tpt-select:focus,
.tpt-input:focus {
  border-color: var(--tpt-primary);
  outline: 2px solid rgba(0, 86, 179, 0.2);
}

/* Radio Pill Group */
.tpt-radio-group {
  display: flex;
  gap: 8px;
}

.tpt-radio-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 10px;
  background: var(--tpt-bg-card);
  border: 1px solid var(--tpt-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.tpt-radio-pill input {
  display: none;
}

.tpt-radio-pill:has(input:checked) {
  background: var(--tpt-primary);
  color: #fff;
  border-color: var(--tpt-primary);
}

/* Target Size Box */
.tpt-target-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Progress & Alert Messages */
.tpt-progress-wrap {
  margin: 20px 0;
  display: none;
}

.tpt-progress-bar-bg {
  width: 100%;
  height: 12px;
  background: var(--tpt-border);
  border-radius: 6px;
  overflow: hidden;
}

.tpt-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--tpt-primary);
  transition: width 0.2s ease;
}

.tpt-progress-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 8px;
}

.tpt-alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 15px 0;
  font-size: 0.95rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tpt-alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}
[data-theme="dark"] .tpt-alert-warning,
.dark-theme .tpt-alert-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.tpt-alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
[data-theme="dark"] .tpt-alert-danger,
.dark-theme .tpt-alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.tpt-alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}
[data-theme="dark"] .tpt-alert-info,
.dark-theme .tpt-alert-info {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

/* Action Area */
.tpt-main-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 25px;
}

.tpt-main-actions .tpt-btn {
  flex: 1 1 200px;
}
