/* ipatool GUI — Modern Fluent & Apple Style CSS */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #181b24;
  --bg-card: #1e2230;
  --bg-card-hover: #262b3d;
  --bg-input: #131620;
  --bg-elevated: #282e42;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #0ea5e9;
  --accent-primary-hover: #0284c7;
  --accent-secondary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --bg-elevated: #ffffff;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: #0284c7;
  
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --accent-primary: #0284c7;
  --accent-primary-hover: #0369a1;
  --accent-secondary: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* NAVBAR */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-gui {
  font-size: 0.7rem;
  font-weight: 800;
  background: var(--accent-gradient);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  /* No text-transform: the brand reads "ipatool webGUI" and the mixed-case
     "webGUI" spelling must survive to the screen. */
  letter-spacing: 0.01em;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Account Status Pill */
.account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.account-pill:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.account-pill.logged-in .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.account-pill.logged-out .status-dot {
  background: var(--danger);
}

/* TABS NAVIGATION */
.tabs-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}

.tabs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tabs-container::-webkit-scrollbar {
  height: 4px;
}

.tabs-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.tab-btn svg {
  width: 18px;
  height: 18px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
  display: block;
}

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

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-header {
  margin-bottom: 20px;
}

.card-header h2, .card-header h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.card-header.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.35);
}

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

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn-inline {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 1.1rem;
}

.full-width {
  width: 100%;
}

/* FORMS & INPUTS */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  padding: 14px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.search-input-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.clear-btn {
  position: absolute;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}

.search-options {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.select-control {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.input-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.input-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.textarea-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: monospace;
  outline: none;
  resize: vertical;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper .icon-btn-inline {
  position: absolute;
  right: 10px;
}

.vertical-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
}

.required {
  color: var(--danger);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-hint code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .col {
  flex: 1;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

/* Checkbox */
.form-checkbox {
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.checkbox-label input {
  position: absolute;
  opacity: 0;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.checkbox-label input:checked ~ .checkbox-custom {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkbox-label input:checked ~ .checkbox-custom::after {
  content: '✓';
  color: white;
  font-size: 13px;
  font-weight: bold;
}

.checkbox-text {
  display: flex;
  flex-direction: column;
}

/* Popular Tags */
.popular-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.tags-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tags-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-chip {
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.tag-chip:hover {
  background: var(--bg-elevated);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* APPS GRID & CARDS */
.results-header {
  margin-bottom: 16px;
}

.results-count-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow: var(--shadow-md);
}

.app-main-info {
  display: flex;
  gap: 14px;
}

.app-icon-img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  background: var(--bg-input);
  flex-shrink: 0;
}

.app-icon-fallback {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
  flex-shrink: 0;
}

.app-meta {
  flex: 1;
  min-width: 0;
}

.app-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-artist {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.app-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 500;
}

.badge-price {
  background: var(--success-bg);
  color: var(--success);
}

.badge-version {
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-primary);
}

/* Minimum supported iOS version badge shown next to the display version. */
.badge-ios {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  font-size: 0.68rem;
  padding: 1px 6px;
  white-space: nowrap;
  vertical-align: middle;
  cursor: help;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.app-identifiers {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
}

.id-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.id-label {
  color: var(--text-muted);
}

.id-value {
  font-family: monospace;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.copy-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.75rem;
  border-radius: 4px;
}

.copy-icon-btn:hover {
  color: var(--accent-primary);
  background: var(--bg-elevated);
}

.app-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.app-actions .btn {
  flex: 1;
}

/* STATE CONTAINERS (Loading / Empty) */
.state-container {
  text-align: center;
  padding: 48px 24px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(14, 165, 233, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* VERSIONS TABLE */
.versions-result-wrapper {
  margin-top: 20px;
}

.versions-meta-card {
  background: var(--bg-input);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.versions-header-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.versions-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.versions-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.versions-table th {
  background: var(--bg-secondary);
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.versions-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.versions-table tr:last-child td {
  border-bottom: none;
}

.versions-table tr:hover {
  background: var(--bg-card-hover);
}

/* DOWNLOADS TAB */
.downloads-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.active-download-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.active-dl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.active-dl-title {
  font-weight: 600;
  font-size: 1rem;
}

.dl-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.dl-progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.dl-progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.empty-state-mini {
  text-align: center;
  padding: 24px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.history-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-file-icon {
  font-size: 1.5rem;
}

.history-filename {
  font-weight: 500;
  font-size: 0.9rem;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ACCOUNT TAB */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.full-grid-width {
  grid-column: 1 / -1;
}

.account-user-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
}

.account-info-grid {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.info-label {
  color: var(--text-secondary);
}

.info-value.mono {
  font-family: monospace;
}

.text-success {
  color: var(--success);
}

.account-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.login-intro {
  text-align: center;
  margin-bottom: 20px;
}

.login-shield-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

/* File Dropzone */
.file-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
  background: var(--bg-input);
}

.file-dropzone:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.dropzone-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.paste-json-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Alert Boxes */
.info-alert {
  display: flex;
  gap: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 16px;
}

.alert-icon {
  font-size: 1.5rem;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-top: 14px;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--warning);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-top: 14px;
  line-height: 1.4;
}

.toast-warning { border-left: 4px solid var(--warning); }

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.batch-dl-warning {
  color: var(--warning);
  font-size: 0.8rem;
  margin-top: 4px;
  line-height: 1.35;
}

/* GUIDE TAB */
.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.guide-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
}

.guide-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--accent-gradient);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.guide-title {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.guide-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.guide-list {
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-list a {
  color: var(--accent-primary);
  text-decoration: none;
}

.guide-list a:hover {
  text-decoration: underline;
}

/* FAQ Accordion */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--text-muted);
}

.faq-item[open] .faq-question::after {
  content: '−';
}

.faq-answer {
  padding: 0 18px 14px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-icon, .modal-app-icon {
  font-size: 2.8rem;
  margin-bottom: 8px;
}

.two-factor-inputs {
  margin: 20px 0;
}

.code-input {
  font-size: 1.8rem;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 12px;
  font-weight: 700;
  font-family: monospace;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions .btn {
  flex: 1;
}

/* Download Steps in Modal */
.dl-progress-box {
  background: var(--bg-input);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.dl-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.dl-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dl-step .step-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

.dl-step.active {
  color: var(--accent-primary);
  font-weight: 600;
}

.dl-step.active .step-icon {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.dl-step.completed {
  color: var(--success);
}

.dl-step.completed .step-icon {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.25s ease-out;
  max-width: 360px;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--accent-primary); }

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

/* Batch Mass Download Tab */
.batch-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.batch-status-row:last-child { border-bottom: none; }

.batch-status-icon { flex-shrink: 0; width: 20px; text-align: center; }

.batch-status-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.batch-status-id { flex-shrink: 0; font-size: 0.8rem; }
.batch-status-label { flex-shrink: 0; font-size: 0.8rem; color: var(--text-secondary); }

.batch-app-card { padding: 14px 16px; }
.batch-app-select { margin-bottom: 10px; }
.batch-app-select .checkbox-text { display: flex; flex-direction: column; gap: 2px; }
.batch-app-select .app-artist { font-size: 0.8rem; }

.batch-versions-details { width: 100%; min-width: 0; }
.batch-versions-details summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.batch-versions-details summary::-webkit-details-marker { display: none; }
.batch-versions-box {
  margin-top: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  background: var(--bg-card);
  overflow-x: auto;
  max-width: 100%;
}
.batch-versions-table { width: 100%; }
.batch-versions-table td, .batch-versions-table th { padding: 8px 12px; }
.batch-version-select-cell { text-align: center; }
.batch-version-select-cell .checkbox-label { justify-content: center; }
.batch-versions-hint {
  margin-top: 10px;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Keep the version-history block from pushing past the app card edges when the
   Действие/Action column is expanded. */
.batch-app-card .app-actions {
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
}
.batch-app-card .app-actions .btn { flex: initial; }

.batch-filtered-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}
.batch-filtered-row:last-child { border-bottom: none; }

.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.batch-download-row {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: var(--bg-input);
}
.batch-download-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.batch-download-row-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.8rem;
}
.dl-progress-bar-bg.slim { height: 6px; margin-bottom: 4px; }

/* Utility Helpers */
.text-secondary { color: var(--text-secondary); }
.badge-pulse {
  background: var(--accent-primary);
  color: white;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@media (max-width: 768px) {
  .navbar { padding: 10px 16px; }
  .tabs-nav { padding: 0 12px; }
  .main-content { padding: 16px 12px; }
  .form-row { flex-direction: column; }
  .apps-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
}

/* INSTALL .IPA TO IOS DEVICE */
.install-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.install-devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.install-device-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.install-device-card:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.install-device-card.selected {
  border-color: var(--accent-primary);
  background: rgba(14, 165, 233, 0.08);
  box-shadow: 0 0 0 1px var(--accent-primary) inset;
}

.install-device-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.install-device-meta {
  min-width: 0;
}

.install-device-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.install-device-model {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.install-device-udid {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  margin-top: 2px;
}

.install-device-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.install-log-details {
  font-size: 0.85rem;
}

.install-log-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  user-select: none;
}

.install-log-output {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 8px 0 0;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Indeterminate progress for commands that do not report byte progress. */
.dl-progress-bar-fill.installing {
  width: 100%;
  background-color: var(--accent-primary);
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.25) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.25) 75%,
    transparent 75%,
    transparent
  );
  background-size: 24px 24px;
  animation: install-stripes 1s linear infinite;
}

@keyframes install-stripes {
  from { background-position: 0 0; }
  to { background-position: 24px 0; }
}

/* SEARCH: removed-from-App-Store results separation */
.results-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.results-header-divider {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  margin-top: 24px;
}

.badge-removed {
  background: var(--warning-bg);
  color: var(--warning);
}

.app-card.removed-app-card {
  border-style: dashed;
}

.app-icon-fallback.removed-icon {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
}

/* DONATE TAB */
.donate-container {
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
}

.donate-content {
  flex: 1 1 320px;
  min-width: 280px;
}

.donate-icon {
  font-size: 2.6rem;
  margin-bottom: 8px;
}

.donate-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.donate-content p {
  margin-bottom: 20px;
  max-width: 480px;
}

.donate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.donate-qr {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.donate-qr-img {
  width: 220px;
  height: 220px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: #ffffff;
  padding: 10px;
  box-shadow: var(--shadow-md);
}

.donate-qr-caption {
  font-size: 0.8rem;
  text-align: center;
}

/* Crypto wallet table under the donate block. The labels stay in English for
   every UI language, so nothing here is localized. */
.donate-crypto {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.donate-crypto-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.donate-crypto td code {
  font-size: 0.82rem;
  word-break: break-all;
}

.donate-crypto .copy-icon-btn {
  margin-left: 6px;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .donate-container {
    justify-content: center;
    text-align: center;
  }
  .donate-content p {
    margin-left: auto;
    margin-right: auto;
  }
  .donate-actions {
    justify-content: center;
  }
}

/* PURCHASE HISTORY TAB */
.purchases-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.purchases-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.purchases-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.purchases-toolbar .search-input-wrapper {
  flex: 1 1 280px;
  max-width: 480px;
}

.purchases-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.purchases-table td:nth-child(1) {
  font-weight: 500;
}

.purchases-table td code {
  font-size: 0.82rem;
  word-break: break-all;
}

.purchases-table .purchases-row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

#purchases-refresh-btn svg {
  transition: transform 0.6s ease;
}

#purchases-refresh-btn.is-loading svg {
  animation: spin 0.8s linear infinite;
}

#purchases-refresh-btn.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.text-muted {
  color: var(--text-muted);
}

/* ==========================================
   VERSION LIST PAGER (version history tab + batch tab)
   ========================================== */
.versions-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 10px 0;
  font-size: 0.85rem;
}

.versions-pager-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.versions-pager-nav .btn:disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.versions-pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-size: 0.8rem;
}

.select-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
}

.versions-pager-slot:empty {
  display: none;
}

.batch-versions-box .versions-pager {
  margin: 4px 0 8px;
}

.demo-banner { position: sticky; top: 0; z-index: 1000; padding: 9px 16px; text-align: center; color: #dbeafe; background: linear-gradient(90deg, #1d4ed8, #7c3aed); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.demo-banner-link { color: #ffffff; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.demo-banner-link:hover, .demo-banner-link:focus { color: #ffffff; text-decoration-thickness: 2px; }
.demo-banner-link:visited { color: #ffffff; }
