/* ==========================================================================
   TÂM Y DUNG BRAND DESIGN SYSTEM
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Dosis:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Brand Teal Palette */
  --blue-chill-50: #eafffd;
  --blue-chill-100: #cafffb;
  --blue-chill-200: #9cfffa;
  --blue-chill-300: #57fffa;
  --blue-chill-400: #0cfbff;
  --blue-chill-500: #00ddea;
  --blue-chill-600: #00afc4;
  --blue-chill-700: #008799;
  --blue-chill-800: #0b6e7f;
  --blue-chill-900: #0e5b6b;
  --blue-chill-950: #023d4a;

  /* Brand Accents */
  --copper-gold: #CD7F32;
  --gold-primary: #d4af37;
  --text-black: #313133;
  --text-gray: #686868;

  /* Backgrounds */
  --bg-primary: #f9f7ee;
  --bg-nav: #efede4;
  --card-white: #ffffff;
  --border-color: #E8DEDE;
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 4px 12px rgba(0, 135, 153, 0.08);
  --shadow-hover: 0 10px 25px rgba(0, 135, 153, 0.15);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Dosis', 'Plus Jakarta Sans', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-black);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: 60px;
}

/* Scrollbar */
body::-webkit-scrollbar {
  width: 8px;
  background-color: #F5F5F5;
}
body::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background-color: var(--blue-chill-700);
}

/* --------------------------------------------------------------------------
   LOGIN OVERLAY SCREEN (FULLSCREEN BACKDROP)
   -------------------------------------------------------------------------- */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #f9f7ee;
  background: radial-gradient(circle at center, #ffffff 0%, #f9f7ee 60%, #efede4 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.login-screen.hidden {
  display: none !important;
}

.login-card {
  background: #ffffff;
  border: 2px solid var(--copper-gold);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0, 135, 153, 0.18);
  text-align: center;
}

.login-header {
  margin-bottom: 28px;
}

.login-logo-img {
  height: 64px;
  width: auto;
  margin-bottom: 14px;
  object-fit: contain;
}

.login-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--blue-chill-700);
  letter-spacing: 1px;
}

.login-header p {
  font-size: 13px;
  color: var(--copper-gold);
  font-weight: 600;
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}

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

.logged-user-badge {
  background: rgba(0, 135, 153, 0.1);
  color: var(--blue-chill-700);
  border: 1px solid var(--blue-chill-700);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
}

.btn-logout {
  background: var(--bg-nav);
  border: 1px solid var(--border-color);
  color: #dc2626;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-logout:hover {
  background: #dc2626;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
.app-header {
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

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

.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-chill-700);
  letter-spacing: 0.5px;
}

.brand-tagline {
  font-size: 12px;
  color: var(--copper-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 35px;
  border: 1px solid var(--border-color);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-gray);
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Dosis', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.nav-tab:hover {
  color: var(--blue-chill-700);
}

.nav-tab.active {
  background: var(--blue-chill-700);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 137, 153, 0.3);
}

.badge-edge {
  background: rgba(205, 127, 50, 0.1);
  color: var(--copper-gold);
  border: 1px solid rgba(205, 127, 50, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   LAYOUT & CARDS
   -------------------------------------------------------------------------- */
.main-content {
  max-width: 1240px;
  margin: 28px auto 0;
  padding: 0 24px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.card {
  background: var(--card-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.icon-gold {
  color: var(--copper-gold);
}

/* --------------------------------------------------------------------------
   QUICK SHORTEN FORM
   -------------------------------------------------------------------------- */
.quick-shorten-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quick-shorten-bar {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.flex-url {
  flex: 2;
}

.flex-slug {
  flex: 1.2;
}

.flex-btn {
  flex: 0.8;
}

.invisible-label {
  user-select: none;
  visibility: hidden;
}

.btn-quick-shorten {
  width: 100%;
  height: 48px;
  white-space: nowrap;
  font-size: 18px;
}

/* INSTANT RESULT BOX */
.instant-result-box {
  background: linear-gradient(135deg, rgba(0, 135, 153, 0.08), rgba(205, 127, 50, 0.08));
  border: 2px solid var(--blue-chill-700);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  animation: slideInRight 0.3s ease;
}

.instant-result-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-chill-700);
  text-transform: uppercase;
}

.result-url {
  font-size: 20px;
  font-weight: 800;
  color: var(--blue-chill-950);
  text-decoration: none;
  font-family: 'Dosis', sans-serif;
}

.result-url:hover {
  text-decoration: underline;
  color: var(--copper-gold);
}

.result-actions {
  display: flex;
  gap: 10px;
}

/* COLLAPSIBLE OG ACCORDION */
.og-accordion {
  background: var(--bg-nav);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.og-summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 700;
  color: var(--blue-chill-700);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: var(--transition);
}

.og-summary:hover {
  background: rgba(0, 135, 153, 0.08);
}

.summary-hint {
  font-size: 13px;
  color: var(--text-gray);
  font-weight: 400;
}

.og-accordion-body {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
}

/* --------------------------------------------------------------------------
   FORM ELEMENTS
   -------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.full-width {
  grid-column: span 2;
}

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

.form-group label {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue-chill-950);
}

.req {
  color: #dc2626;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-black);
  font-size: 15px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus {
  border-color: var(--blue-chill-700);
  box-shadow: 0 0 0 3px rgba(0, 135, 153, 0.15);
}

.input-prefix-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.input-prefix {
  background: var(--bg-nav);
  color: var(--blue-chill-700);
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border-right: 1px solid var(--border-color);
  white-space: nowrap;
}

.input-prefix-box input {
  border: none;
  background: transparent;
}

.input-with-btn {
  display: flex;
  gap: 10px;
}

.hint {
  font-size: 13px;
  color: var(--text-gray);
  margin-top: 2px;
}

/* OG Live Preview Box */
.og-preview-box {
  margin-top: 14px;
  background: var(--bg-nav);
  border: 1px dashed var(--blue-chill-700);
  border-radius: var(--radius-md);
  padding: 16px;
}

.og-preview-card {
  max-width: 480px;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.og-img-wrapper {
  position: relative;
  width: 100%;
  height: 250px;
  background: #f9f7ee;
  overflow: hidden;
}

.og-img-wrapper img#og-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.og-preview-meta {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.og-site {
  font-size: 11px;
  color: var(--copper-gold);
  font-weight: 700;
  text-transform: uppercase;
}

.og-preview-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-black);
}

.og-preview-desc {
  font-size: 13px;
  color: var(--text-gray);
}

.hidden {
  display: none !important;
}

/* BUTTONS */
.btn-primary {
  background: var(--blue-chill-600);
  color: #ffffff;
  border: none;
  border-radius: 35px;
  padding: 14px 32px;
  font-size: 18px;
  font-weight: 700;
  font-family: 'Dosis', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(0, 175, 196, 0.3);
}

.btn-primary:hover {
  background: var(--blue-chill-700);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 135, 153, 0.4);
}

.btn-primary-cld {
  background: linear-gradient(135deg, #008799, #0e5b6b);
  color: #ffffff;
  border: none;
  border-radius: 35px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Dosis', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 135, 153, 0.25);
}

.btn-primary-cld:hover {
  background: var(--copper-gold);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-nav);
  color: var(--blue-chill-700);
  border: 1px solid var(--blue-chill-700);
  border-radius: 35px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Dosis', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--blue-chill-700);
  color: #ffffff;
}

.btn-icon {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-black);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--blue-chill-700);
  color: #ffffff;
  border-color: var(--blue-chill-700);
}

/* --------------------------------------------------------------------------
   LIST & TABLE
   -------------------------------------------------------------------------- */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.list-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.list-title h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--blue-chill-700);
}

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

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

.search-box i {
  position: absolute;
  left: 12px;
  color: var(--text-gray);
  width: 18px;
}

.search-box input {
  padding-left: 38px;
  width: 280px;
  border-radius: 30px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: var(--bg-nav);
  color: var(--blue-chill-700);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 2px solid var(--border-color);
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(239, 237, 228, 0.4);
}

.og-thumb-col {
  display: flex;
  align-items: center;
  gap: 12px;
}

.og-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  background: #f1f5f9;
}

.link-title-box {
  display: flex;
  flex-direction: column;
}

.link-title {
  font-weight: 700;
  color: var(--text-black);
}

.link-desc {
  font-size: 12px;
  color: var(--text-gray);
}

.short-url-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.short-url-link {
  color: var(--blue-chill-700);
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
}

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

.btn-copy-sm {
  background: rgba(0, 135, 153, 0.1);
  border: 1px solid var(--blue-chill-700);
  color: var(--blue-chill-700);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.orig-url {
  color: var(--text-gray);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.badge-clicks {
  background: rgba(205, 127, 50, 0.12);
  color: var(--copper-gold);
  border: 1px solid rgba(205, 127, 50, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
}

.badge-active {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.action-btns {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.action-btn {
  background: var(--bg-nav);
  border: 1px solid var(--border-color);
  color: var(--blue-chill-700);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.action-btn:hover {
  background: var(--blue-chill-700);
  color: #ffffff;
}

.action-btn.delete:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* --------------------------------------------------------------------------
   ANALYTICS & STATS
   -------------------------------------------------------------------------- */
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-emerald { background: rgba(0, 135, 153, 0.1); color: var(--blue-chill-700); border: 1px solid rgba(0, 135, 153, 0.2); }
.icon-purple { background: rgba(205, 127, 50, 0.1); color: var(--copper-gold); border: 1px solid rgba(205, 127, 50, 0.2); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 14px;
  color: var(--text-gray);
  font-weight: 600;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--blue-chill-950);
  font-family: 'Dosis', sans-serif;
}

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.chart-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-chill-700);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-wrapper {
  height: 280px;
  position: relative;
}

/* --------------------------------------------------------------------------
   MODALS & TOASTS
   -------------------------------------------------------------------------- */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  color: var(--blue-chill-700);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-gray);
  font-size: 24px;
  cursor: pointer;
}

.qrcode-container {
  display: flex;
  justify-content: center;
  background: #ffffff;
  padding: 16px;
  border-radius: 12px;
  margin: 16px auto;
  width: max-content;
  border: 1px solid var(--border-color);
}

.modal-brand-logo {
  height: 54px;
  margin-bottom: 12px;
}

.qr-url-text {
  font-size: 14px;
  color: var(--text-gray);
  word-break: break-all;
  margin-bottom: 16px;
}

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

.toast {
  background: var(--blue-chill-700);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 135, 153, 0.3);
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.readonly-input {
  background: var(--bg-nav) !important;
  cursor: not-allowed;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .quick-shorten-bar { flex-direction: column; align-items: stretch; gap: 12px; }
  .invisible-label { display: none; }
  .instant-result-content { flex-direction: column; align-items: flex-start; }
  .form-grid, .charts-grid, .stats-overview-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: span 1; }
  .header-container { flex-direction: column; gap: 16px; align-items: flex-start; }
}
