/* QIQR Site Stylesheet */

/* Base Styles */
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 20px;
  background: #f5f5f5;
}

body.landing-page {
  margin: 0;
  background: #fff;
}

body.landing-page .container {
  padding: 0 20px;
}

body.app-page {
  margin: 0;
}

body.app-page .container {
  padding: 0 20px;
}

/* Centered Auth Pages (Login/Register) */
body.auth-page {
  margin: 0;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  min-height: 100vh;
}

/* Containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

.profile-container,
.login-container,
.register-container {
  max-width: 600px;
  margin: 0 auto;
}

.login-container,
.register-container {
  max-width: 400px;
  width: 100%;
  background: white;
  border: 1px solid #e3e3e3;
  border-radius: 12px;
  padding: 40px;
}

/* Headers */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.header h1 {
  margin: 0;
}

.site-header {
  background: white;
  border-bottom: 1px solid #e3e3e3;
  padding: 14px 0;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 18px;
}

.site-header-nav a {
  color: #333;
  font-weight: 600;
}

.site-header-nav a:hover {
  color: #0066cc;
}

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

.plan-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f0f4f8;
  color: #333;
  border: 1px solid #d6e2ee;
}

.plan-badge--paid {
  background: #e8f4fd;
  color: #0066cc;
  border-color: #c6e0f6;
}

.site-header--auth {
  width: 100%;
  margin-bottom: 24px;
}

.site-logo {
  font-size: 22px;
  font-weight: 700;
  color: #333;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.site-logo:hover {
  color: #0066cc;
  text-decoration: none;
}

.site-logo-img {
  height: 32px;
  max-height: 32px;
  width: auto;
  max-width: 180px;
  display: block;
}

.site-logo-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Landing header (index/about/pricing/contact) */
.announcement-bar {
  background: #0066cc;
  color: white;
  text-align: center;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
}

.landing-header {
  --landing-row-height: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: repeat(5, var(--landing-row-height));
  column-gap: 32px;
  padding: 0 40px;
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow: visible;
}

.landing-header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(100% - var(--landing-row-height));
  background: white;
  border-bottom: 1px solid #e3e3e3;
  z-index: 0;
}

.landing-header > * {
  position: relative;
  z-index: 1;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
  grid-column: 1;
  grid-row: 1 / span 5;
  justify-self: start;
  align-self: end;
}

.landing-header--app .logo {
  grid-column: auto;
  grid-row: auto;
  justify-self: auto;
  align-self: center;
}

.landing-header--app .app-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  grid-column: 1;
  grid-row: 1 / span 5;
  justify-self: start;
  align-self: end;
}

.logo-img {
  height: 58px;
  max-height: 58px;
  width: auto;
  max-width: 180px;
  display: block;
  transform: none;
}

.logo-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.nav-menu {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.landing-header nav {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: center;
  justify-self: center;
}

.nav-menu a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 16px;
  position: relative;
  padding: 4px 2px 8px;
}

.nav-menu a:hover {
  color: #0066cc;
}

.nav-menu a.is-active {
  color: #0066cc;
}

.nav-menu a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: #0066cc;
  border-radius: 999px;
}

.landing-header .nav-menu .btn,
.landing-header .nav-menu .btn:hover {
  color: white;
}

.login-btn {
  background: #0066cc;
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 15px;
  display: inline-block;
  grid-column: 3;
  grid-row: 1 / span 4;
  align-self: center;
  justify-self: end;
}

.landing-header--app .login-btn {
  grid-column: auto;
  grid-row: auto;
  align-self: auto;
  justify-self: auto;
}

.landing-header--app .app-header-right {
  grid-column: 3;
  grid-row: 1 / span 4;
  align-self: center;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.landing-header--app .app-welcome {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.login-btn:hover {
  background: #0052a3;
  text-decoration: none;
}

.landing-auth {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  grid-column: 3;
  grid-row: 1 / span 4;
  align-self: center;
  justify-self: end;
}

.landing-auth .btn {
  padding: 10px 18px;
}

.cookie-banner {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #e3e3e3;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 16px 20px;
  display: none;
}

.cookie-banner.is-visible {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cookie-banner p {
  margin: 0;
  color: #555;
  font-size: 14px;
}

.cookie-banner-actions {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.cookie-banner .btn {
  padding: 8px 14px;
  font-size: 13px;
}

/* Landing login modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 40px;
  max-width: 400px;
  width: 90%;
  position: relative;
  animation: slideUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.modal-close:hover {
  color: #333;
}

.modal-title {
  margin: 0 0 24px 0;
  font-size: 28px;
  color: #333;
  text-align: center;
}

.modal-error {
  background: #fee;
  color: #c00;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  border: 1px solid #fcc;
}

.header-links a {
  text-decoration: none;
  color: #0066cc;
  margin: 0 8px;
}

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

@media (max-width: 768px) {
  .landing-header {
    --landing-row-height: 0px;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    row-gap: 16px;
    padding: 16px 20px;
  }

  .landing-header::before {
    height: 100%;
  }

  .landing-header nav,
  .landing-header .login-btn,
  .landing-header .logo {
    grid-column: 1;
    grid-row: auto;
    justify-self: center;
    align-self: center;
  }

  .nav-menu {
    gap: 20px;
    font-size: 14px;
  }
}

@media (max-width: 600px) {
  .logo-img {
    height: 46px;
    max-height: 46px;
    max-width: 160px;
    transform: none;
  }

  .announcement-bar {
    padding: 10px 16px;
    font-size: 13px;
  }

  .landing-header {
    text-align: center;
  }

  .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
  }

  .login-btn {
    width: 100%;
    max-width: 240px;
  }
}

/* Dashboard specific header */
.container .header {
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e3e3e3;
  margin-bottom: 20px;
}

/* Links */
.back-link {
  text-decoration: none;
  color: #0066cc;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

a {
  color: #0066cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: #0066cc;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  background: #0052a3;
  text-decoration: none;
}

.btn-secondary {
  background: #666;
}

.btn-secondary:hover {
  background: #555;
}

button[type="submit"] {
  background: #0066cc;
  color: white;
  padding: 12px 32px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

button[type="submit"]:hover {
  background: #0052a3;
}

.login-container button[type="submit"],
.register-container button[type="submit"] {
  width: 100%;
  padding: 14px;
}

/* Sections */
.section,
.form-section,
.profile-section {
  background: white;
  border: 1px solid #e3e3e3;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.section h2,
.section h3,
.form-section h2,
.form-section h3,
.profile-section h2 {
  margin-top: 0;
  color: #333;
}

.profile-section h2 {
  margin-top: 0;
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-edit-toggle {
  padding: 6px 14px;
  font-size: 13px;
}

.account-edit-fields {
  display: none;
  margin-top: 16px;
}

.account-section.is-editing .account-edit-fields {
  display: block;
}

.account-section.is-editing .account-display-row {
  display: none;
}

.account-edit-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Info Sections */
.info-section {
  background: #f9f9f9;
  border: 1px solid #e3e3e3;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.info-section p {
  margin: 0;
  color: #666;
}

.info-section code {
  background: white;
  padding: 4px 8px;
  border-radius: 4px;
  color: #0066cc;
  word-break: break-all;
}

.user-info {
  color: #666;
  font-size: 14px;
  margin-bottom: 20px;
  padding: 12px 20px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e3e3e3;
}

.action-cell {
  white-space: normal;
}

.action-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.action-divider {
  color: #ccc;
}

.add-destination {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-top: 0;
}

.add-dest-error {
  background: #fee;
  color: #c00;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid #fcc;
  font-size: 13px;
}

.add-dest-form {
  display: none;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.add-destination.is-open .add-dest-form {
  display: flex;
}

.add-destination.is-open .add-dest-toggle {
  display: none;
}

.add-dest-fields {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(200px, 1.6fr);
  gap: 12px;
  align-items: flex-end;
}

.add-dest-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.add-dest-label {
  margin-bottom: 0;
  font-weight: 500;
}

.add-destination .add-dest-label input {
  margin-top: 6px;
}

.add-dest-toggle {
  padding: 8px 12px;
  background: #f0f4f8;
  border: 1px solid #d6e2ee;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #0066cc;
}

.add-dest-toggle:hover {
  background: #e3eaf0;
}

.cancel-add-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #f3b9b9;
  background: #fee;
  color: #c00;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.cancel-add-btn:hover {
  background: #fbdada;
}

.row-actions-cell {
  padding: 0;
  border-top: none;
}

.row-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
}

.inactive-destinations-placeholder {
  min-height: 24px;
}

/* Error Messages */
.error-message {
  background: #fee;
  color: #c00;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #fcc;
}

.login-container .error-message,
.register-container .error-message {
  text-align: center;
}

/* Forms */
label {
  display: block;
  margin-bottom: 20px;
  color: #333;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select {
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

input[type="file"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

input[type="checkbox"] {
  width: auto;
  display: inline-block;
  margin-right: 8px;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

label.checkbox-label {
  display: flex;
  align-items: center;
}

small {
  color: #666;
  font-size: 13px;
  line-height: 1.5;
}

/* Tables */
.qr-table-container {
  background: white;
  border-radius: 12px;
  border: 1px solid #e3e3e3;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 20px;
}

.qr-table-container table {
  min-width: 720px;
}

.dashboard-table th {
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #f9f9f9;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #e3e3e3;
}

td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: #fafafa;
}

td a {
  color: #0066cc;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}

.qr-preview {
  width: 96px;
  height: 96px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-active {
  color: #0a0;
  font-weight: 500;
}

.status-paused {
  color: #999;
}

.status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
}

.status-btn--active {
  background: #e6f7ee;
  color: #167a3d;
  border-color: #bfe6ce;
  cursor: pointer;
}

.status-btn--active:hover {
  background: #d6f2e2;
}

.status-btn--inactive {
  background: #f1f1f1;
  color: #777;
  border-color: #ddd;
}

.status-btn--inactive-action {
  cursor: pointer;
}

.status-btn--inactive-action:hover {
  background: #e8e8e8;
}

.status-error {
  margin-top: 6px;
  font-size: 12px;
  color: #c00;
}

/* Action Bar */
.action-bar {
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
}

/* Profile Components */
.profile-field {
  margin-bottom: 16px;
}

.profile-field-label {
  font-weight: bold;
  color: #333;
  margin-bottom: 4px;
}

.profile-field-value {
  color: #666;
  font-size: 16px;
  word-break: break-word;
}

.stat-card {
  background: #f9f9f9;
  padding: 16px;
  border-radius: 8px;
}

.stat-label {
  color: #666;
  font-size: 14px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
  color: #0066cc;
}

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

/* Analytics Components */
.trend-container {
  background: #f9f9f9;
  padding: 16px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  overflow-x: auto;
}

.trend-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.trend-date {
  color: #666;
}

.chart-container {
  width: 100%;
  height: 320px;
}

.chart-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: #666;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-label {
  font-weight: 600;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.trend-count {
  color: #0066cc;
  font-weight: 600;
}

/* Premium Notice */
.premium-notice {
  background: #f9f9f9;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e3e3e3;
}

.premium-notice em {
  font-style: normal;
  color: #666;
}

.premium-notice a {
  color: #0066cc;
}

/* Auth Page Links */
.register-link,
.login-link {
  text-align: center;
  margin-top: 20px;
  color: #666;
}

.register-link a,
.login-link a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 500;
}

.register-link a:hover,
.login-link a:hover {
  text-decoration: underline;
}

/* Footer */
.footer-links {
  text-align: center;
  padding: 20px;
}

/* Page Titles */
h1 {
  color: #333;
}

.login-container h1,
.register-container h1 {
  margin: 0 0 30px 0;
  text-align: center;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

@media (max-width: 900px) {
  body {
    margin: 16px;
  }

  .container {
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .site-header-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .site-header-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .site-logo-img {
    height: 26px;
    max-height: 26px;
    max-width: 160px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

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

  .action-bar {
    flex-wrap: wrap;
  }

  .action-bar .btn {
    flex: 1 1 200px;
    text-align: center;
  }

  .profile-container,
  .login-container,
  .register-container {
    padding: 24px;
  }

  .section,
  .form-section,
  .profile-section {
    padding: 18px;
  }

  .qr-preview {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 600px) {
  .header-links span {
    display: none;
  }

  th,
  td {
    padding: 10px;
  }
}
