/* The Sources tab's pieces (F4): the UIAlertView (nav/alert.js), table edit mode and swipe-to-delete, source
   icons and the Done bar button. Sizes are the kit's @2x halved; colours from its layers as named. */

/* ---- "Alert diaglog": 272px wide, 10px corners, #0b1b43 at 80%, a 2px #b1b7c1 -> #e1e3e3 rim, 8px/19px shadow,
   a white gloss over the top 31px that dips in a curve. ---- */
.alert-scrim {
  /* a screen's height past each edge (nav/alert.js: no white shows when iOS pans for the keyboard) */
  position: fixed; inset: -100vh 0; z-index: 30; display: grid; place-items: center; padding: calc(100vh + 16px) 16px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.25), rgba(0,0,0,.6) 70%) center / 100% 100vh no-repeat, rgba(0,0,0,.6);
}
.alert {
  /* iOS 6's 284pt, widened to fit longer text and button labels on today's wider screens */
  position: relative; width: min(340px, 100%); padding: 16px 12px 11px; border-radius: 10px;
  transition: translate .3s cubic-bezier(.25,.1,.25,1); /* glides above the keyboard (nav/alert.js) instead of jumping */
  color: #fff; text-align: center; text-shadow: 0 -1px 0 rgba(0,0,0,.8);
  background: rgba(11,27,67,.8); border: 2px solid #b1b7c1; border-bottom-color: #e1e3e3;
  box-shadow: 0 8px 19px rgba(0,0,0,.9);
}
.alert::before { /* "gloss" */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 31px; border-radius: 8px 8px 0 0;
  background: radial-gradient(ellipse 150% 100% at 50% 0, rgba(255,255,255,.5), rgba(255,255,255,.25) 99%, transparent 100%);
  pointer-events: none;
}
.alert-title { position: relative; margin: 0 0 6px; font-size: 18px; line-height: 22px; font-weight: bold; }
.alert-message { position: relative; margin: 0 0 10px; font-size: 16px; line-height: 20px; overflow-wrap: anywhere; white-space: pre-line; } /* \n breaks lines, as in Cydia's About */
.alert-field {
  display: block; width: 100%; height: 31px; margin: 6px 0 12px; padding: 0 8px; border-radius: 4px;
  font: inherit; font-size: 16px; color: #000; text-shadow: none; -webkit-user-select: text; user-select: text;
  background: #fff; border: 1px solid #3c4c6d; box-shadow: inset 0 2px 3px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.2);
  outline: none;
}
.alert-buttons { position: relative; display: flex; gap: 8px; margin-top: 4px; }
.alert-buttons.stacked { flex-direction: column; gap: 9px; }
.alert-buttons.stacked .alert-button { flex: none; height: 43px; } /* three or more stack at the full height, not squeezed (flex: 1 in a column) */
/* Alert buttons as Cydia's UIAlertView draws them on the 4S (ref/4s/screens/cydia-about.png, sampled): opaque greys
   over the navy, a gloss split at half, a dark edge, no white line on top or below. These are the kit's "Button
   (continue)" values, which match the device. background-origin: border-box after every background. */
.alert-button {
  flex: 1; min-width: 0; height: 43px; padding: 0 6px; border-radius: 5px; cursor: pointer;
  font-size: 18px; font-weight: bold; color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.8);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  border: 1px solid rgba(19,29,57,.9); box-shadow: none;
  background: linear-gradient(#b4b9c8, #5f6882 49%, #596484 51%, #4d597a); background-origin: border-box;
}
.alert-button.cancel { /* "Button (Cancel)": darker */
  background: linear-gradient(#707a91, #283659 49%, #0b1b43 50%, #182747); background-origin: border-box;
}
.alert-button:active, .alert-button.is-pressed {
  background: linear-gradient(#6d7da3, #3c4e7d 49%, #22325e 51%, #2f3f6c); background-origin: border-box;
}
/* F96: a button held back by a countdown (showAlert's `countdown`): greyed out, not pressable, until it ends. */
.alert-button:disabled { cursor: default; color: rgba(255,255,255,.45); text-shadow: none;
  background: linear-gradient(#b4b9c8, #5f6882 49%, #596484 51%, #4d597a); background-origin: border-box; }

/* ---- Done: "Button (Gloss Blue)" ---- */
.bar-button.done {
  border-color: #1f3f86; border-top-color: #30363e;
  background: linear-gradient(#79a1f3, #3b71e1 49%, #215fdd 51%, #2361dd);
}
.bar-button.done:active { background: linear-gradient(#5f86d6, #2a5bc0 49%, #164bb8 51%, #184db9); }

/* ---- source rows ---- */
.source-row .cell-inner { min-height: 53px; } /* Cydia's 53pt rows */
.source-row .cell-icon { position: relative; overflow: hidden; }
.source-row .cell-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.source-row .cell-icon img:not(.loaded) { opacity: 0; }
.source-row .cell-error { color: #b0262a; }
.source-row { position: relative; overflow: hidden; }

/* ---- edit mode and swipe-to-delete, as Cydia does it on the 4S (ref/4s/screens/cy-sources-edit*.png): the red
   minus slides in solid with the row (the row clips it until then), the row's content narrows in step so its text
   ellipsizes instead of jumping, and the chevron fades. Tapping the minus turns its bar upright and the Delete
   button opens from the right edge while the text makes room. Colours from the 4S art: UIRemoveControlMinus (disc),
   UIRemoveControlRed / ...PressedRed (Delete). No white rows under anything (the art's edge rows aren't drawn). ---- */
.del-toggle {
  position: absolute; left: 7px; top: 50%; width: 29px; height: 29px; margin-top: -14.5px; padding: 0; border: 0;
  background: none; cursor: pointer; transform: translateX(-40px); transition: transform .3s ease-in-out;
}
.del-toggle::before { /* UIRemoveControlMinus: 2pt white rim, glossy top half, flat red bottom, soft shadow */
  content: ""; position: absolute; inset: 0; box-sizing: border-box; border-radius: 50%; border: 2px solid #fff;
  background: linear-gradient(#dd878d, #c73742 50%, #bd1421 50%, #bd1421); background-origin: border-box;
  box-shadow: 0 1.5px 2px rgba(0,0,0,.45);
}
.del-toggle::after { /* the white bar, drawn apart from the disc so it can turn */
  content: ""; position: absolute; left: 8px; right: 8px; top: 13px; height: 3px; border-radius: 1px; background: #fff;
  box-shadow: 0 -.5px 0 rgba(0,0,0,.2); transition: transform .25s ease-in-out;
}
.source-row .cell-inner { width: 100%; transition: transform .3s ease-in-out, width .3s ease-in-out; }
.source-row .cell-inner.chevron::after, .source-row .cell-detail, .source-row .cell-count { transition: opacity .2s ease; }
.editing .source-row .del-toggle { transform: none; }
.editing .source-row .cell-inner { transform: translateX(37px); width: calc(100% - 37px); }
.editing .source-row .cell-inner.chevron::after { opacity: 0; }
.source-row.armed .del-toggle::after { transform: rotate(-90deg); }
.source-row.armed .cell-inner { width: calc(100% - 76px); } /* room for Delete; the URL ellipsizes */
.editing .source-row.armed .cell-inner { width: calc(100% - 37px - 76px); }
.del-confirm { /* UIRemoveControlRed: dark top edge, gloss over the top half, flat red, dark red bottom edge */
  position: absolute; right: 9px; top: 50%; height: 32px; margin-top: -16px; padding: 0 11px; border-radius: 6px;
  font-size: 15px; font-weight: bold; color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.4); cursor: pointer;
  border: 1px solid; border-color: #2c1c1c #6b1516 #721819;
  background: linear-gradient(#f6989c, #d64a4e 50%, #cf2d2f 50%, #cf2b2d); background-origin: border-box;
  box-shadow: none;
  clip-path: inset(0 0 0 100% round 6px); pointer-events: none; transition: clip-path .22s ease-out;
}
.del-confirm:active, .del-confirm.is-pressed {
  background: linear-gradient(#a75a61, #93252e 50%, #8d141e 50%, #8d131e); background-origin: border-box;
}
.source-row.armed .del-confirm { clip-path: inset(0 round 6px); pointer-events: auto; }
.source-row.armed .cell-detail, .source-row.armed .cell-count, .source-row.armed .cell-inner.chevron::after { opacity: 0; }
.source-row.removing { opacity: 0; transition: opacity .2s ease-out; }
.source-row { touch-action: pan-y; }

/* ---- Recommended (F52, screens/manage.js): Sources' rows with a round Add on the right instead of Delete.
   The GET look the user asked for: a white pill with blue bold text and a thin blue rim, filled blue
   with white text while held; "Added" greyed and inert once the source is in the list. No gloss or shadow. ---- */
.rec-row .cell-inner { padding-right: 84px; }
.rec-get {
  position: absolute; right: 10px; top: 50%; min-width: 58px; height: 26px; margin-top: -13px; padding: 0 12px;
  border-radius: 13px; border: 1px solid #2f7de1; background: #fff; color: #2f7de1; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: bold; line-height: 24px; text-align: center; text-shadow: none;
  box-shadow: none; -webkit-tap-highlight-color: transparent;
}
.rec-get:active:not(:disabled), .rec-get.is-pressed { background: #2f7de1; color: #fff; }
.rec-get.added, .rec-get:disabled { border-color: #c4c4c9; color: #9a9aa0; background: #fff; cursor: default; }
.rec-apps { margin-top: 10px; } /* a preview's apps under its grouped head */
.rec-packages .pkg-row > .cell-inner::after { content: none; } /* F54: a repo not added yet has no package pages: no chevron */

/* The Add Source alert's field with its Paste button beside it (nav/alert.js input.paste). */
.alert-field-row { display: flex; gap: 6px; margin: 6px 0 12px; }
.alert-field-row .alert-field { flex: 1; min-width: 0; margin: 0; }
.alert-paste {
  flex: none; height: 31px; padding: 0 10px; border-radius: 5px; cursor: pointer; font: inherit; font-size: 14px; font-weight: bold; color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,.8); border: 1px solid rgba(19,29,57,.9);
  background: linear-gradient(#b4b9c8, #5f6882 49%, #596484 51%, #4d597a); background-origin: border-box;
}
.alert-paste:active { background: linear-gradient(#8a90a3, #3f4863 49%, #39446a 51%, #2f3a5c); background-origin: border-box; }

/* F72: Cydian's own source is built in: a lock where Delete's minus would be (Manage's edit list), and a small one
   after its name (nav/lock.js). It never shows Delete. */
.source-lock {
  position: absolute; left: 7px; top: 50%; width: 29px; height: 29px; margin-top: -14.5px; display: flex;
  align-items: center; justify-content: center; pointer-events: none; transform: translateX(-40px);
  transition: transform .3s ease-in-out;
}
.editing .source-row .source-lock { transform: none; }
.name-lock { display: inline-block; margin-left: 5px; vertical-align: -1px; line-height: 0; }
.name-lock svg, .source-lock svg { display: block; }
/* Coloured alert buttons (nav/alert.js colors): iOS 6's green "go" and red destructive, the same gloss split at half
   and dark edge as the greys. Greyed while counting down (disabled). */
.alert-button.green { background: linear-gradient(#6fcf5a, #2f9d22 49%, #1f8c13 50%, #2a961c); background-origin: border-box; border-color: #134f0c; }
.alert-button.red { background: linear-gradient(#e46a6a, #c51f1f 49%, #b30f0f 50%, #bd1a1a); background-origin: border-box; border-color: #5e0909; }
.alert-button.green:active, .alert-button.green.is-pressed { background: linear-gradient(#4fae3c, #1e7a14 49%, #136a0a 50%, #1a7512); }
.alert-button.red:active, .alert-button.red.is-pressed { background: linear-gradient(#bf4c4c, #9c1414 49%, #880909 50%, #941010); }
.alert-button.red:disabled, .alert-button.green:disabled { opacity: .5; }
