/* ════════════════════════════════════════
   Maninho Criativos — Admin Panel CSS
   ════════════════════════════════════════ */

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

:root {
  --cyan:    #00d4ff;
  --blue:    #0066ff;
  --purple:  #7b2ff7;
  --green:   #22c55e;
  --red:     #ef4444;
  --dark:    #030810;
  --dark2:   #070e1c;
  --dark3:   #0c1728;
  --surface: #0f1d30;
  --surface2:#162438;
  --border:  rgba(0,212,255,0.1);
  --border2: rgba(0,212,255,0.22);
  --text:    #ffffff;
  --text2:   rgba(255,255,255,0.6);
  --text3:   rgba(255,255,255,0.3);
  --radius:  14px;
  --ease:    cubic-bezier(0.4,0,0.2,1);
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--dark);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.5;
}

/* ── LOGIN SCREEN ── */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0,102,255,0.2), transparent),
              var(--dark);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 24px;
  padding: 44px 40px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.5), 0 0 60px rgba(0,102,255,0.08);
}

.login-logo { height: 44px; width: auto; object-fit: contain; align-self: center; margin-bottom: 4px; }

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.5px;
}

.login-sub {
  font-size: 0.9rem;
  color: var(--text2);
  text-align: center;
  margin-top: -8px;
  margin-bottom: 4px;
}

.error-msg {
  font-size: 0.82rem;
  color: var(--red);
  text-align: center;
  min-height: 18px;
}

/* ── INPUTS ── */
.admin-input {
  width: 100%;
  background: var(--dark3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}
.admin-input::placeholder { color: var(--text3); }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .admin-input { padding-right: 44px; }
.input-wrap .btn-icon {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.input-wrap .btn-icon:hover { opacity: 1; }

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.22s var(--ease);
  box-shadow: 0 0 20px rgba(0,212,255,0.25);
  white-space: nowrap;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(0,212,255,0.4);
}
.btn-primary.full { width: 100%; }
.btn-primary.small { padding: 8px 16px; font-size: 0.82rem; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  background: var(--dark3);
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--surface2); color: var(--text); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.18s;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--border); color: var(--text); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 13px;
  background: rgba(239,68,68,0.1);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

/* ── LAYOUT ── */
#admin-panel {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100dvh;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--dark2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 12px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 4px 12px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-logo-img { height: 30px; width: auto; object-fit: contain; }
.sidebar-logo-text { font-size: 0.95rem; font-weight: 700; color: var(--cyan); }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.snav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--text2);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  text-align: left;
}
.snav-item:hover { background: var(--surface); color: var(--text); }
.snav-item.active {
  background: linear-gradient(135deg, rgba(0,212,255,0.12), rgba(0,102,255,0.12));
  color: var(--cyan);
  font-weight: 700;
  border: 1px solid rgba(0,212,255,0.15);
}
.snav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.snav-item.ghost { color: var(--text3); }
.snav-item.ghost:hover { color: var(--text2); }

/* ── MAIN ── */
.admin-main {
  background: var(--dark);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(3,8,16,0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-page-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  flex: 1;
}

.mobile-menu-btn { display: none; }

/* ── TAB CONTENT ── */
.tab-content { display: none; padding: 28px; flex: 1; }
.tab-content.active { display: block; }

/* ── PANEL CARD ── */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.panel-card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.link-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── FORM FIELDS ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row.three { grid-template-columns: repeat(3, 1fr); }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-field label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.color-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-picker {
  width: 40px;
  height: 38px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--dark3);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── LINK PREVIEW ── */
.link-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--dark3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}
.preview-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.preview-title { font-size: 0.95rem; font-weight: 600; flex: 1; }
.preview-arrow { color: var(--text3); font-size: 1rem; }

/* ── FORM ACTIONS ── */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ── LINKS TABLE ── */
.links-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 18px;
  overflow: hidden;
}

.table-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.table-count {
  font-size: 0.82rem;
  color: var(--text2);
  font-weight: 600;
}

.links-table { display: flex; flex-direction: column; }

.table-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.18s;
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--dark3); }

.table-row-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.table-row-info { min-width: 0; }
.table-row-title {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}
.table-row-url {
  font-size: 0.8rem;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.table-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Status badge */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  white-space: nowrap;
}
.status-badge.on  { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.status-badge.off { background: var(--surface2); color: var(--text3); border: 1px solid var(--border); }
.status-badge:hover { filter: brightness(1.2); }

/* Click counter */
.click-count {
  font-size: 0.78rem;
  color: var(--text3);
  background: var(--dark3);
  padding: 4px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Skeleton */
.table-skeleton {
  height: 76px;
  background: linear-gradient(90deg,
    var(--surface) 25%,
    var(--surface2) 50%,
    var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-bottom: 1px solid var(--border);
}
.table-skeleton:last-child { border-bottom: none; }
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3,8,16,0.75);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }

#edit-link-form { padding: 24px; display: flex; flex-direction: column; gap: 18px; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 999;
  transition: transform 0.3s var(--ease), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success { border-color: rgba(34,197,94,0.4); color: #4ade80; }
.toast.error   { border-color: rgba(239,68,68,0.4);  color: #f87171; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  #admin-panel { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    box-shadow: 8px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }

  .mobile-menu-btn { display: flex; }

  .tab-content { padding: 20px 16px; }

  .form-row, .form-row.three { grid-template-columns: 1fr; }

  .table-row { grid-template-columns: 44px 1fr; }
  .table-row-actions { grid-column: 1/-1; justify-content: flex-end; padding-top: 4px; }
}

@media (max-width: 480px) {
  .login-card { padding: 32px 24px; }
  .panel-card-header { padding: 16px 16px; }
  .link-form { padding: 16px; }
  .table-header-row { padding: 14px 16px; }
  .table-row { padding: 14px 16px; }
}
