@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #090914;
  --bg2: #0f0f23;
  --surface: rgba(255, 255, 255, 0.04);
  --surface2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #7c3aed;
  --accent2: #4f46e5;
  --accent-light: rgba(124, 58, 237, 0.15);
  --accent-glow: rgba(124, 58, 237, 0.4);
  --text: #f1f0ff;
  --text2: #9491b4;
  --text3: #5e5b7a;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --tr: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl
}

/* ── SCREENS ── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: hidden
}

.screen.active {
  opacity: 1;
  pointer-events: all
}

/* ── SPLASH ── */
#screen-splash {
  background: radial-gradient(ellipse at center, #1a0a3a 0%, var(--bg) 70%);
  align-items: center;
  justify-content: center
}

.splash-logo {
  width: 100px;
  height: 100px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px
}

.splash-logo svg {
  width: 52px;
  height: 52px;
  fill: url(#grad1);
  filter: drop-shadow(0 0 24px var(--accent-glow));
  z-index: 1
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.35;
  animation: rpulse 2s ease-in-out infinite
}

.ring2 {
  animation-delay: .6s;
  opacity: .15;
  inset: -12px;
  border-color: #4f46e5
}

@keyframes rpulse {

  0%,
  100% {
    transform: scale(1);
    opacity: .35
  }

  50% {
    transform: scale(1.12);
    opacity: .1
  }
}

.splash-title {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text
}

.splash-sub {
  color: var(--text2);
  font-size: 14px;
  margin-top: 4px
}

.dots {
  display: flex;
  gap: 8px;
  margin-top: 20px
}

.dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: dbounce 1.2s ease-in-out infinite
}

.dots span:nth-child(2) {
  animation-delay: .2s;
  background: var(--accent2)
}

.dots span:nth-child(3) {
  animation-delay: .4s;
  background: #818cf8
}

@keyframes dbounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: .4
  }

  40% {
    transform: scale(1);
    opacity: 1
  }
}

/* ── AUTH SCREENS ── */
#screen-setup,
#screen-login,
#screen-connect {
  background: radial-gradient(ellipse at top, #1a0a3a 0%, var(--bg) 60%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-screen-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  width: 100%;
  padding: 24px 20px;
  flex-grow: 1;
}

.auth-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 28px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow), 0 0 60px rgba(124, 58, 237, 0.08)
}

.auth-logo {
  width: 64px;
  height: 64px;
  background: var(--accent-light);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  border: 1px solid rgba(124, 58, 237, 0.3)
}

.auth-logo svg {
  width: 34px;
  height: 34px;
  fill: var(--accent);
  filter: drop-shadow(0 0 10px var(--accent-glow))
}

.auth-card h2 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px
}

.auth-desc {
  color: var(--text2);
  font-size: 13px;
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.6
}

/* ── FORMS ── */
.form-group {
  margin-bottom: 18px
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px
}

.form-group label .opt {
  font-weight: 400;
  color: var(--text3)
}

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

input.field,
textarea.field {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: var(--tr);
  resize: vertical
}

.input-wrap input,
.input-wrap textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  padding: 12px 14px 12px 44px;
  outline: none;
  transition: var(--tr);
  resize: vertical
}

.input-wrap input:focus,
.input-wrap textarea:focus,
input.field:focus,
textarea.field:focus {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15)
}

.eye-btn {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  padding: 4px;
  transition: var(--tr)
}

.eye-btn:hover {
  color: var(--text)
}

.eye-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor
}

.error-msg {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  display: none
}

.error-msg.show {
  display: block
}

/* ── STRENGTH BAR ── */
.strength-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden
}

.strength-fill {
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 0.4s ease, background 0.4s ease
}

.strength-text {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--tr);
  text-decoration: none;
  white-space: nowrap
}

.btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35)
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5)
}

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

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border)
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15)
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2)
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2)
}

.btn-ghost {
  background: none;
  color: var(--text2);
  border: none;
  padding: 8px 12px
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface)
}

.btn-full {
  width: 100%;
  margin-top: 8px
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--tr);
  color: var(--text2)
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor
}

.icon-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15)
}

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

/* ── APP HEADER ── */
#screen-main {
  background: var(--bg)
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  background: rgba(9, 9, 20, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px
}

.header-logo {
  width: 40px;
  height: 40px;
  background: var(--accent-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(124, 58, 237, 0.25)
}

.header-logo svg {
  width: 22px;
  height: 22px;
  fill: var(--accent)
}

.header-title {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1
}

.header-stats {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px
}

.header-actions {
  display: flex;
  gap: 8px
}

/* ── SEARCH ── */
.search-bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0
}

.search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  gap: 10px;
  transition: var(--tr)
}

.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12)
}

.search-wrap svg {
  width: 18px;
  height: 18px;
  fill: var(--text3);
  flex-shrink: 0
}

.search-wrap input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  padding: 11px 0;
  outline: none
}

.search-clear {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  padding: 2px
}

.search-clear svg {
  width: 16px;
  height: 16px;
  fill: currentColor
}

.hidden {
  display: none !important
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.main-content::-webkit-scrollbar {
  width: 4px
}

.main-content::-webkit-scrollbar-track {
  background: transparent
}

.main-content::-webkit-scrollbar-thumb {
  background: var(--surface2);
  border-radius: 4px
}

/* ── VIEW: GRID (default) ── */
/* ⚠️ gap: 30px - لا تغير هذه القيمة - تم تأكيدها من المستخدم */
#list-view.view-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  align-items: start;
  grid-auto-rows: auto;
  flex-direction: unset;
  align-content: start;
  row-gap: 76px;
}

#list-view.view-grid .site-card {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 12px 16px;
  gap: 8px;
  min-height: 120px;
  justify-content: center;
  position: relative;
}

#list-view.view-grid .site-card .site-select-checkbox {
  position: absolute;
  top: 10px;
  right: 10px;
  margin: 0;
}

#list-view.view-grid .site-favicon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 22px;
  flex-shrink: 0
}

#list-view.view-grid .site-info {
  width: 100%;
  flex: unset
}

#list-view.view-grid .card-tags {
  justify-content: center;
}

#list-view.view-grid .site-name {
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  max-width: 100%
}

#list-view.view-grid .site-meta {
  display: none
}

#list-view.view-grid .site-count {
  font-size: 10px;
  padding: 2px 8px;
  margin-top: 2px;
  align-self: center
}

#list-view.view-grid .chevron {
  display: none
}

@media(min-width:500px) {
  #list-view.view-grid {
    grid-template-columns: repeat(3, 1fr)
  }
}

@media(min-width:800px) {
  #list-view.view-grid {
    grid-template-columns: repeat(4, 1fr)
  }
}

@media(min-width:1100px) {
  #list-view.view-grid {
    grid-template-columns: repeat(5, 1fr)
  }
}

/* ── VIEW: LIST ── */
#list-view.view-list {
  display: flex;
  flex-direction: column;
  gap: 8px
}

#list-view.view-list .site-card {
  flex-direction: row;
  padding: 14px 16px
}

/* ── VIEW: COMPACT ── */
#list-view.view-compact {
  display: flex;
  flex-direction: column;
  gap: 3px
}

#list-view.view-compact .site-card {
  padding: 10px 14px;
  border-radius: 8px;
  gap: 10px
}

#list-view.view-compact .site-favicon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 14px;
  flex-shrink: 0
}

#list-view.view-compact .site-name {
  font-size: 13px
}

#list-view.view-compact .site-meta {
  display: none
}

#list-view.view-compact .site-count {
  font-size: 10px;
  padding: 2px 8px
}

/* ── VIEW TOGGLE ── */
.view-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  gap: 0
}

.view-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text3);
  transition: var(--tr)
}

.view-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor
}

.view-btn:hover {
  color: var(--text);
  background: var(--surface2)
}

.view-btn.active {
  background: var(--accent);
  color: #fff
}

.site-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.site-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.05), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: inherit;
}

.site-card:hover {
  border-color: rgba(124, 58, 237, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.site-card:hover::before {
  opacity: 1;
}

.site-favicon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border)
}

.site-favicon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px
}

.site-info {
  flex: 1;
  min-width: 0
}

.site-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.site-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px
}

.site-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(124, 58, 237, 0.2)
}

.chevron {
  fill: var(--text3);
  width: 18px;
  height: 18px;
  flex-shrink: 0
}

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 24px rgba(124, 58, 237, 0.5);
  transition: var(--tr);
  z-index: 20
}

.fab svg {
  width: 26px;
  height: 26px;
  fill: #fff
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(124, 58, 237, 0.7)
}

.fab:active {
  transform: scale(0.96)
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 24px 40px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1)
}

.modal-overlay.open .modal {
  transform: translateY(0)
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 0 auto 20px
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px
}

.modal-title svg {
  width: 22px;
  height: 22px;
  fill: var(--accent)
}

/* ── WEBSITE DETAIL ── */
#detail-view {
  z-index: 15;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg)
}

.back-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--tr)
}

.back-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--text2)
}

.back-btn:hover {
  background: var(--surface2);
  color: var(--text)
}

.detail-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1
}

.detail-url {
  font-size: 11px;
  color: var(--text3)
}

/* ── ACCOUNT CARD ── */
.acc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: var(--tr)
}

.acc-card:hover {
  border-color: rgba(255, 255, 255, 0.12)
}

.acc-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px
}

.acc-username svg {
  width: 14px;
  height: 14px;
  fill: var(--text3)
}

.acc-password-row {
  display: flex;
  align-items: center;
  gap: 8px
}

.acc-password {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: monospace;
  color: var(--text);
  letter-spacing: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.acc-password.visible {
  letter-spacing: 0;
  font-family: 'Cairo', sans-serif
}

.acc-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px
}

.acc-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: 'Cairo', sans-serif;
  color: var(--text2);
  cursor: pointer;
  transition: var(--tr);
  font-weight: 600
}

.acc-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor
}

.acc-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text)
}

.acc-btn.copy:hover {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.25)
}

.acc-btn.edit:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(124, 58, 237, 0.25)
}

.acc-btn.del:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25)
}

/* ── SETTINGS PANEL ── */
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border)
}

.settings-item:last-child {
  border-bottom: none
}

.settings-label {
  font-size: 14px;
  font-weight: 600
}

.settings-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px
}

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: 90%;
  max-width: 380px
}

.toast {
  padding: 12px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Cairo', sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastin 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  white-space: nowrap
}

.toast svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0
}

.toast.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3)
}

.toast.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3)
}

.toast.info {
  background: var(--accent-light);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.3)
}

@keyframes toastin {
  from {
    opacity: 0;
    transform: translateY(10px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  flex: 1;
  grid-column: 1 / -1;
  width: 100%;
}

.empty-icon {
  width: 80px;
  height: 80px;
  background: var(--surface);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border: 1px solid var(--border)
}

.empty-icon svg {
  width: 40px;
  height: 40px;
  fill: var(--text3)
}

.empty-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px
}

.empty-desc {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.7;
  max-width: 250px
}

/* ── SPINNER ── */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block
}

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

/* ── GEN PASSWORD ── */
.gen-result {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: monospace;
  font-size: 16px;
  letter-spacing: 1px;
  text-align: center;
  color: var(--text);
  word-break: break-all;
  min-height: 48px;
  margin-bottom: 12px
}

.gen-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px
}

.gen-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Cairo', sans-serif;
  color: var(--text2);
  transition: var(--tr);
  font-weight: 600
}

.gen-opt.active {
  background: var(--accent-light);
  border-color: rgba(124, 58, 237, 0.4);
  color: var(--accent)
}

.gen-opt input {
  display: none
}

.length-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px
}

.length-row input[type=range] {
  flex: 1;
  accent-color: var(--accent)
}

.length-val {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  min-width: 28px;
  text-align: center
}

/* ── SYNC DOT ── */
.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: var(--tr)
}

.sync-dot.syncing {
  background: var(--warning);
  animation: rpulse 1s ease-in-out infinite
}

.sync-dot.ok {
  background: var(--success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5)
}

.sync-dot.error {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5)
}

.sync-dot.idle {
  background: var(--text3)
}

/* ── RESPONSIVE ── */
@media(min-width:500px) {
  .modal-overlay {
    align-items: center
  }

  .modal {
    border-radius: 24px;
    max-height: 85vh
  }

  #screen-setup,
  #screen-login {
    overflow-y: auto
  }
}

@media(max-width:480px) {
  .auth-card {
    padding: 24px 16px;
    border-radius: 20px;
  }

  .auth-desc {
    margin-bottom: 16px;
    font-size: 12px;
    word-break: break-word;
    white-space: normal;
  }

  .fab {
    bottom: 16px;
    left: 16px;
    width: 50px;
    height: 50px
  }

  .fab svg {
    width: 22px;
    height: 22px;
  }
}

/* ===== PWA TAGS & MERGE STYLING ===== */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  justify-content: flex-start;
}

.card-tag {
  background: rgba(124, 58, 237, 0.08);
  color: var(--accent);
  border: 1px solid rgba(124, 58, 237, 0.25);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-block;
}

.tags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tag-pill {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Cairo', sans-serif;
}

.tag-pill:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}

.tag-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

.clickable-username {
  user-select: text;
  -webkit-user-select: text;
  cursor: pointer;
  transition: color 0.2s;
}

.clickable-username:hover {
  color: var(--accent);
  text-decoration: underline;
}

.detail-url-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.detail-url-link:hover {
  text-decoration: underline;
}

/* ── PWA SITE CARD ACTIONS ── */
.site-actions-pwa {
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 5;
  transition: all 0.2s ease;
}

/* For list and compact views */
#list-view.view-list .site-actions-pwa,
#list-view.view-compact .site-actions-pwa {
  margin-right: auto;
  /* moves it to left side in RTL */
}

/* For grid view */
#list-view.view-grid .site-actions-pwa {
  margin-top: 10px;
  justify-content: center;
  width: 100%;
}

.icon-btn-pwa {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn-pwa:hover {
  background: var(--surface2);
  color: var(--accent);
}

.icon-btn-pwa.delete-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

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

/* ── BATCH ACTIONS & SELECTION ── */
.batch-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 12px 16px;
  font-family: 'Cairo', sans-serif;
  transition: all 0.3s ease;
  gap: 12px;
}

.batch-actions-bar.hidden {
  display: none !important;
}

.batch-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.batch-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.site-select-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  margin-left: 8px;
  /* RTL spacing */
}

@media(min-width: 1000px) {
  .app-header {
    padding-left: calc((100% - 968px) / 2) !important;
    padding-right: calc((100% - 968px) / 2) !important;
  }

  .detail-header {
    padding-left: calc((100% - 968px) / 2) !important;
    padding-right: calc((100% - 968px) / 2) !important;
  }

  .batch-actions-bar {
    padding-left: calc((100% - 968px) / 2) !important;
    padding-right: calc((100% - 968px) / 2) !important;
  }

  .search-wrap {
    max-width: 968px;
    margin: 0 auto;
  }

  .fab {
    left: calc((100% - 968px) / 2) !important;
  }

  .tags-bar {
    justify-content: center;
  }
}