/* ==========================================================================
   TinyURL Platform - Google Antigravity Design System
   ========================================================================== */

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

:root {
  /* Clean Modern Palette - Light */
  --bg-app: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f4f4f5;
  --bg-input: #f4f4f5;
  --border-color: #e4e4e7;
  --border-hover: #d4d4d8;
  --border-focus: #18181b;
  
  --text-main: #09090b;
  --text-muted: #71717a;
  --text-subtle: #a1a1aa;
  
  --btn-primary-bg: #09090b;
  --btn-primary-text: #ffffff;
  --btn-primary-hover: #27272a;
  
  --btn-secondary-bg: #e4e4e7;
  --btn-secondary-text: #09090b;
  --btn-secondary-hover: #d4d4d8;
  
  --accent-blue: #2563eb;
  --accent-red: #dc2626;
  --accent-yellow: #d97706;
  --accent-green: #16a34a;
  
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.04);
  
  --radius-pill: 10px;
  --radius-card: 16px;
  --radius-input: 10px;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  /* Clean Modern Palette - Dark (#171717 Background) */
  --bg-app: #171717;
  --bg-surface: #171717;
  --bg-surface-hover: #222222;
  --bg-input: #222222;
  --border-color: #2a2a2a;
  --border-hover: #3a3a3a;
  --border-focus: #f4f4f5;
  
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
  
  --btn-primary-bg: #f4f4f5;
  --btn-primary-text: #171717;
  --btn-primary-hover: #e4e4e7;
  
  --btn-secondary-bg: #222222;
  --btn-secondary-text: #f4f4f5;
  --btn-secondary-hover: #2e2e2e;
  
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

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

/* Fixed Background Canvas */
#nokey {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

/* Header Navigation */
.ag-header {
  position: sticky;
  top: 0;
  height: 64px;
  background-color: rgba(23, 23, 23, 0.9);
  border-bottom: none;
  z-index: 100;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-theme="light"] .ag-header {
  background-color: rgba(255, 255, 255, 0.9);
}

.ag-header-inner {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

.ag-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: calc(1.15rem + 1px);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.ag-brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ag-logo-icon {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-red), var(--accent-yellow), var(--accent-green));
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  display: inline-block;
  flex-shrink: 0;
}

.ag-byline {
  font-size: calc(0.85rem - 1px);
  color: var(--text-muted);
  font-weight: 500;
}

/* Clickable Author Link (No Underline on Normal or Hover, Color #A7D934) */
.ag-author-link,
.ag-author-link:hover,
.ag-author-link:focus,
.ag-author-link:active {
  color: #A7D934 !important;
  text-decoration: none !important;
}

.ag-author-link {
  font-weight: 600;
  transition: opacity var(--transition);
}

.ag-author-link:hover {
  opacity: 0.85;
}

/* Header Right Side: Tabs + Theme Toggle */
.ag-header-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.ag-nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.ag-nav-item a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: color var(--transition);
}

.ag-nav-item a:hover,
.ag-nav-item a.active {
  color: var(--text-main);
}

/* Modern Minimalist Theme Toggle */
.ag-theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition);
}

.ag-theme-toggle:hover {
  background-color: var(--bg-surface-hover);
}

.ag-theme-svg {
  width: 20px;
  height: 20px;
  color: var(--text-main);
  display: block;
}

.ag-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
}

/* Main Hero Wrapper - Centered Vertically in Viewport */
.ag-hero-wrapper {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
}

.ag-hero-title {
  font-size: clamp(1.4rem, 3.2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 36px;
  white-space: nowrap;
}

/* Open Borderless Workspace (No outer rectangular bounding container) */
.ag-card-workspace {
  width: 100%;
  max-width: 800px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0 auto;
  text-align: left;
}

/* Open Input Bar Group */
.ag-pill-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-input);
  border: none;
  outline: none;
  border-radius: 12px;
  padding: 6px 8px 6px 20px;
  transition: background-color var(--transition);
}

.ag-pill-input-group:focus-within {
  background-color: var(--bg-surface-hover);
}

.ag-input-field {
  flex: 1;
  min-width: 0;
  height: 42px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  background: transparent;
  color: var(--text-main);
  border: none;
  outline: none;
}

.ag-input-field::placeholder {
  color: var(--text-subtle);
}

/* Action Cluster (Scan Icon & SUBMIT Action grouped tightly) */
.ag-action-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Modern Minimalist QR Scan Icon Control */
.ag-scan-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition);
  flex-shrink: 0;
}

.ag-scan-icon-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-hover);
}

.ag-scan-svg {
  width: 20px;
  height: 20px;
}

/* Strong Bold Typographic Action Control (Matches SUBMIT style across all controls) */
.ag-submit-action {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0 10px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition), transform var(--transition);
  flex-shrink: 0;
  text-decoration: none;
}

.ag-submit-action:hover {
  opacity: 0.75;
  transform: translateY(-1px);
}

/* Result Card */
.ag-result-card {
  display: none;
  margin-top: 24px;
  padding: 20px 24px;
  background-color: var(--bg-surface-hover);
  border-radius: var(--radius-card);
  animation: agFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-result-card.show {
  display: block;
}

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

.ag-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ag-result-link {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-decoration: none;
  word-break: break-all;
}

.ag-result-link:hover {
  text-decoration: underline;
}

/* QR Expand Box */
.ag-qr-expand {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
  align-items: center;
  gap: 20px;
}

.ag-qr-expand.show {
  display: flex;
}

.ag-qr-canvas-frame {
  background: #ffffff;
  padding: 8px;
  border-radius: 10px;
  display: inline-block;
  flex-shrink: 0;
}

/* QR Studio Layout (2x QR Code Display Size & Centered Text Actions) */
.ag-qr-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: center;
}

.ag-qr-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ag-form-group {
  margin-bottom: 16px;
}

.ag-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ag-select {
  width: 100%;
  height: 42px;
  padding: 0 16px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: none;
  outline: none;
  border-radius: var(--radius-pill);
  transition: background-color var(--transition);
}

.ag-select:focus {
  background-color: var(--bg-surface-hover);
}

.ag-preview-panel {
  background-color: var(--bg-surface-hover);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ~2x Display Size for QR Code frame */
.ag-preview-img-frame {
  background: #ffffff;
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
}

.ag-preview-img-frame img {
  width: 280px;
  height: 280px;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.ag-qr-actions-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

/* Modals */
.ag-modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-modal-backdrop.show {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

.ag-modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto;
}

.ag-modal-backdrop.show .ag-modal-dialog {
  transform: scale(1);
}

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

.ag-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.ag-btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}

.ag-btn-close:hover {
  color: var(--text-main);
}

/* Toast Notifications Container (Disabled bottom-right toasts per design specification) */
.ag-toast-container {
  display: none !important;
}

/* Footer */
.ag-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 24px 28px;
  border-top: none;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 550;
  position: relative;
  z-index: 1;
  background-color: var(--bg-app);
}

.ag-footer p {
  font-weight: 550;
}

.ag-footer .ag-author-link {
  font-size: calc(0.85rem + 2px);
}

/* Animations */
@keyframes agFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes agSlide {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Responsive Layout */
@media (max-width: 820px) {
  .ag-hero-title {
    white-space: normal;
  }
}

@media (max-width: 768px) {
  .ag-hero-wrapper {
    padding: 32px 16px;
  }

  .ag-nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-app);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    box-shadow: var(--shadow-card);
  }

  .ag-nav-links.open {
    display: flex;
  }

  .ag-mobile-toggle {
    display: block;
  }

  .ag-qr-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .ag-pill-input-group {
    flex-wrap: wrap;
    border-radius: 12px;
    padding: 10px;
    gap: 10px;
  }

  .ag-input-field {
    width: 100%;
    height: 40px;
  }

  .ag-result-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .ag-qr-expand {
    flex-direction: column;
    text-align: center;
  }
}
