﻿:root {
  --vel-gold: #b1783f;
  --vel-gold-dark: #7f4f24;
  --vel-gold-light: #f3e2c2;
  --vel-ink: #3b2816;
  --vel-blue: #8b5e34;
  --vel-bg: #fcf5e9;
  --vel-surface: #fffaf1;
  --vel-border: #e6c9a0;
}

/* ========================= */
/* RESET + GLOBAL */
/* ========================= */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(145deg, #fdf8ef, #f3e2c2);
  color: var(--vel-ink);
  line-height: 1.6;
}

body.loading {
  overflow: hidden;
}

/* ========================= */
/* HEADER */
/* ========================= */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 40px;
  background: linear-gradient(90deg, #f7e8ce, #f3e2c2);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--vel-border);
}

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

.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--vel-gold), var(--vel-gold-dark));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  box-shadow: none;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

.logo.logo-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
}

.name {
  font-weight: 700;
  font-size: 18px;
}

.tag {
  font-size: 12px;
  color: #7a6330;
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--vel-border);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-direction: column;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #6b531c;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.inline {
  display: inline-flex;
  flex-direction: row;
  width: auto;
  margin: 0;
  gap: 0;
}

nav a,
.link-button {
  text-decoration: none;
  color: var(--vel-gold-dark);
  font-weight: 600;
  position: relative;
  transition: 0.2s ease;
  padding: 8px 10px;
  border-radius: 10px;
}

.link-button {
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

nav a:hover,
.link-button:hover {
  color: var(--vel-ink);
  background: rgba(255, 255, 255, 0.55);
}

/* ========================= */
/* LAYOUT */
/* ========================= */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 50px auto;
  padding: 0 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.dashboard-grid .create-card {
  order: 1;
}

.dashboard-grid .links-card {
  order: 2;
  display: flex;
  flex-direction: column;
}

/* ========================= */
/* HERO */
/* ========================= */

.hero {
  background: var(--vel-surface);
  border-radius: 22px;
  padding: 60px;
  box-shadow: 0 20px 50px rgba(31, 75, 153, 0.08);
}

.hero h1 {
  margin: 0;
  font-size: 42px;
}

.hero-actions {
  margin-top: 28px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ========================= */
/* CARDS */
/* ========================= */

.card {
  background: var(--vel-surface);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.06);
  overflow: hidden; /* prevents form overflow */
}

.card.narrow {
  max-width: 420px;
  margin: 0 auto;
}

.admin-overview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.admin-stat-card {
  background: #f8ebd2;
  border: 1px solid var(--vel-border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-stat-card span {
  font-size: 12px;
  color: #7a6330;
}

.admin-stat-card strong {
  font-size: 20px;
  color: #5b430d;
  line-height: 1.1;
}

.admin-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-quick-links a,
.admin-quick-links button {
  text-decoration: none;
  color: #6b531c;
  background: #fff3bf;
  border: 1px solid var(--vel-border);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.admin-quick-links a:hover,
.admin-quick-links button:hover {
  background: #f1d9b3;
}

.admin-section-toggle.is-active {
  background: #e9c89a;
  border-color: var(--vel-gold);
}

.admin-toggle-section {
  display: none;
}

.admin-toggle-section.is-open {
  display: block;
}

/* ========================= */
/* FORM SYSTEM */
/* ========================= */

form {
  display: flex;
  flex-direction: column;
  gap: 20px; /* universal vertical rhythm */
  width: 100%;
}

.site-header form {
  display: inline-flex;
  flex-direction: row;
  width: auto;
  gap: 0;
}

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

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
}

.form-row .form-group {
  flex: 1;
  min-width: 220px;
}

label {
  font-weight: 600;
}

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 999px;
  background: #f1d9b3;
  color: #7a5a08;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  position: relative;
  vertical-align: middle;
  outline: none;
}

.info-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  max-width: 280px;
  width: max-content;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--vel-border);
  background: #f8ebd2;
  color: #5b430d;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  white-space: normal;
}

.info-tip:hover::after,
.info-tip:focus::after {
  opacity: 1;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d8c3a5;
  font-size: 14px;
  transition: 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--vel-gold);
  box-shadow: 0 0 0 3px rgba(224, 167, 0, 0.15);
}

/* Password Toggle */
.input-group {
  position: relative;
}

.input-group input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--vel-gold-dark);
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.form-note {
  margin-top: 6px;
  margin-bottom: 10px;
  text-align: right;
}

.form-note a {
  font-size: 13px;
  color: #8b5e34;
  text-decoration: none;
  font-weight: 600;
}

.form-note a:hover {
  text-decoration: underline;
}

/* ========================= */
/* BUTTONS */
/* ========================= */

.button {
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(135deg, var(--vel-gold), var(--vel-gold-dark));
  color: #fff;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0);
}

.button.ghost {
  background: var(--vel-gold-light);
  color: var(--vel-gold-dark);
}

.button.danger {
  background: linear-gradient(135deg, #dc2626, #991b1b);
}

.card form .button {
  width: 100%;
}

/* ========================= */
/* URL LIST */
/* ========================= */

.url-item {
  padding: 14px 0;
  border-bottom: 1px solid #eef1f6;
}

.url-code {
  font-weight: 700;
  color: var(--vel-gold-dark);
}

.url-actions a {
  margin-right: 14px;
  color: var(--vel-gold-dark);
  font-weight: 600;
  text-decoration: none;
}

/* ========================= */
/* ALERTS */
/* ========================= */

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 500;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

/* ========================= */
/* TABLE */
/* ========================= */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 14px 0 18px;
}

.table-scroll {
  width: 100%;
  overflow-x: scroll;
  scrollbar-gutter: stable both-edges;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.table-scroll table {
  min-width: 980px;
}

.table-scroll th,
.table-scroll td {
  white-space: nowrap;
}

.created-link-alert {
  margin: 10px 0 18px;
}

.duplicate-form {
  margin: 0;
}

.duplicate-modal .confirm-modal-box {
  width: min(94vw, 560px);
}

.duplicate-link-line {
  margin-top: 8px;
  margin-bottom: 0;
  background: #fff4df;
  border: 1px solid var(--vel-border);
  border-radius: 10px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
}

.clear-links-form {
  margin-top: auto;
  padding-top: 8px;
}

.table-scroll::-webkit-scrollbar {
  height: 10px;
}

.table-scroll::-webkit-scrollbar-track {
  background: #f1debe;
  border-radius: 999px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: #b1783f;
  border-radius: 999px;
}

table th,
table td {
  padding: 12px;
  border-bottom: 1px solid #eef1f6;
}

table th {
  font-weight: 600;
  color: var(--vel-gold-dark);
}

.table-action-btn {
  border: 1px solid var(--vel-border);
  background: #fff3bf;
  color: #6b531c;
  border-radius: 8px;
  padding: 5px 10px;
  font-weight: 600;
  cursor: pointer;
}

.table-action-btn:hover {
  background: #f1d9b3;
}

.detail-row {
  display: none;
}

.detail-row.is-open {
  display: table-row;
}

.detail-row td {
  background: #f9edd8;
  color: #6b531c;
}

/* ========================= */
/* FOOTER */
/* ========================= */

.site-footer {
  text-align: center;
  padding: 28px;
  background: linear-gradient(90deg, #f1debe, #e8c999);
  color: #6b531c;
  font-size: 14px;
}

.policy-links {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.policy-links a {
  color: #6b531c;
  text-decoration: none;
  font-weight: 600;
}

.policy-links a:hover {
  text-decoration: underline;
}

.page-loader {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 25% 20%, #f9ebd2 0%, #f3e2c2 45%, #e8c999 100%);
  display: grid;
  place-items: center;
  z-index: 1200;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow: hidden;
}

.page-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 8px;
  background: linear-gradient(135deg, #e0a700, #6b531c);
  border-radius: 10px;
  transform: rotate(45deg);
  box-shadow: 0 8px 20px rgba(107, 83, 28, 0.22);
  position: relative;
  animation: pulse-rotate 0.9s ease-in-out infinite;
}

.loader-spinner::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 8px;
  background: rgba(255, 248, 220, 0.9);
}

.loader-spinner::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--vel-surface);
  top: -3px;
  left: calc(50% - 3px);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  animation: orbit-dot 0.9s linear infinite;
}

.loader-box {
  text-align: center;
  width: min(82vw, 220px);
  padding: 8px 8px;
  position: relative;
  z-index: 2;
}

.loader-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #6b531c;
}

.loader-subtitle {
  margin-top: 3px;
  font-size: 11px;
  color: #7a6330;
}

.loader-powered {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  font-size: 13px;
  color: #8b6b2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}


.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1300;
}

.confirm-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.confirm-modal-box {
  width: min(92vw, 460px);
  background: #fffdf2;
  border: 1px solid var(--vel-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.confirm-modal-box h3 {
  margin: 0 0 8px;
}

.confirm-modal-box p {
  margin: 0;
  color: #6b531c;
}

.confirm-modal-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.auth-divider {
  margin: 14px 0 10px;
  text-align: center;
  color: #8b6b2a;
  font-size: 13px;
}

.auth-divider span {
  position: relative;
  padding: 0 8px;
}

.auth-divider span::before,
.auth-divider span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30px;
  height: 1px;
  background: var(--vel-border);
}

.auth-divider span::before {
  right: 100%;
}

.auth-divider span::after {
  left: 100%;
}

.social-google {
  width: 100%;
  text-align: center;
  background: #fff;
  color: #4a2f1a;
  border: 1px solid #e7d4b7;
  box-shadow: 0 10px 24px rgba(74, 47, 26, 0.08);
  gap: 8px;
}

.social-google:hover {
  background: #fff8ee;
  border-color: #dcb689;
}

.google-mark {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #dcb689;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #8b5e34;
  background: #fff4df;
  flex-shrink: 0;
}

.login-side-prompt {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 320px;
  background: #fff;
  border: 1px solid #e8d7bc;
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(59, 40, 22, 0.18);
  padding: 14px 14px 12px;
  z-index: 1350;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  overflow: hidden;
}

.login-side-prompt.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.login-side-prompt::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, #f0d8b5, #e6bf8f);
}

.login-side-prompt h3 {
  margin: 4px 28px 6px 0;
  color: #4a2f1a;
  font-size: 15px;
  font-weight: 700;
}

.login-side-prompt p {
  margin: 0 0 8px;
  color: #6b531c;
  font-size: 12px;
  line-height: 1.35;
}

.prompt-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8b6b2a;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.prompt-close:hover {
  background: #fff4df;
}

.prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-actions .social-google {
  font-size: 14px;
  min-height: 42px;
}

/* ========================= */
/* MOBILE HEADER FIX */
/* ========================= */

@media (max-width: 720px) {
  .site-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .brand {
    justify-content: flex-start;
    flex: 1 1 auto;
  }

  .nav-toggle {
    display: inline-flex;
  }

  nav {
    width: 100%;
    overflow: hidden;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
  }

  nav.is-open {
    max-height: 320px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  nav a,
  .link-button,
  .inline {
    width: 100%;
  }

  nav a,
  .link-button {
    display: inline-flex;
    justify-content: center;
    min-height: 42px;
    align-items: center;
    background: rgba(255, 255, 255, 0.55);
  }

  .inline {
    display: flex;
  }

  .hero {
    padding: 36px 22px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .card {
    padding: 24px;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid .create-card {
    margin: 0 16px;
  }

  .dashboard-grid .create-card form {
    gap: 14px;
  }

  .container {
    margin: 24px auto;
    padding: 0 14px;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid .create-card {
    order: 1;
  }

  .dashboard-grid .links-card {
    order: 2;
  }

  .confirm-modal-actions {
    flex-direction: column;
  }

  .loader-title {
    font-size: 30px;
  }

  .loader-powered {
    bottom: 18px;
  }
}

@media (max-width: 900px) {
  .login-side-prompt {
    display: none !important;
  }
}

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

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

@keyframes orbit-dot {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-rotate {
  0% {
    transform: rotate(45deg) scale(0.95);
  }
  50% {
    transform: rotate(225deg) scale(1.05);
  }
  100% {
    transform: rotate(405deg) scale(0.95);
  }
}



