/* Copyright (c) 2025 Princess of Whales. All rights reserved. */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Canva Sans', sans-serif;
  line-height: 1.6;
  color: #03345b; /* Secondary */
  background-color: #fffbf2; /* Background */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Font Styles */
h1, h2, h3, h4, h5, h6, .hero-title, .logo, .stat-number, .stat-text {
  font-family: 'Radley', serif;
}

.hero-subtitle, .suggestion-description, .link-url {
  font-family: 'Canva Sans', sans-serif;
  font-style: italic;
}


/* Layout Components */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  padding: 2rem 0;
}

/* Header and Navigation */
.header {
  background: #fae8e8; /* Primary */
  border-bottom: 1px solid #cddde7; /* Accent */
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: #03345b; /* Secondary */
  text-decoration: none;
  transition: color 0.2s ease;
}

.logo:hover {
  color: #a0c381; /* Accent */
}

.nav-menu {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: #03345b; /* Secondary */
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #a0c381; /* Accent */
}

/* Footer */
.footer {
  background: #fae8e8; /* Primary */
  border-top: 1px solid #cddde7; /* Accent */
  padding: 1.5rem 0;
  margin-top: auto;
  text-align: center;
  color: #03345b; /* Secondary */
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-primary {
  background: #03345b; /* Secondary */
  color: #fae8e8; /* Primary */
}

.btn-primary:hover {
  background: #a0c381; /* Accent */
  color: #03345b;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #cddde7; /* Accent */
  color: #03345b; /* Secondary */
}

.btn-secondary:hover {
  background: #a0c381; /* Accent */
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-info {
  background: #17a2b8;
  color: white;
}

.btn-info:hover {
  background: #138496;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-full {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #03345b; /* Secondary */
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 2px solid #cddde7; /* Accent */
  border-radius: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: #fff;
}

.form-input:focus {
  outline: none;
  border-color: #a0c381; /* Accent */
  box-shadow: 0 0 0 3px rgba(160, 195, 129, 0.2);
}

.form-input:disabled {
  background-color: #fae8e8; /* Primary */
  color: #6c757d;
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #03345b; /* Secondary */
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

/* Flash Messages */
.flash-messages {
  margin-bottom: 2rem;
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.flash-success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.flash-error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.flash-info {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

.flash-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.7;
}

.flash-close:hover {
  opacity: 1;
}

/* Homepage Styles */
.homepage {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero {
  padding: 4rem 0 6rem;
}

.hero-title {
  font-size: 4rem;
  font-weight: 700;
  color: #03345b; /* Secondary */
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: #03345b; /* Secondary */
  margin-bottom: 3rem;
  opacity: 0.8;
}

.search-container {
  position: relative;
  max-width: 500px;
  margin: 0 auto 2rem;
}

.search-form {
  position: relative;
}

.search-input-container {
  display: flex;
  border: 2px solid #cddde7; /* Accent */
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: #fff;
}

.search-input-container:focus-within {
  border-color: #a0c381; /* Accent */
  box-shadow: 0 0 0 3px rgba(160, 195, 129, 0.2);
}

.search-input {
  flex: 1;
  padding: 1rem;
  font-size: 1.1rem;
  border: none;
  outline: none;
  background-color: transparent;
  color: #03345b;
}

.search-button {
  padding: 1rem 2rem;
  background: #03345b; /* Secondary */
  color: #fae8e8; /* Primary */
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-button:hover {
  background: #a0c381; /* Accent */
  color: #03345b;
}

.suggestions-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #cddde7; /* Accent */
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.suggestion-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #fae8e8; /* Primary */
  text-align: left;
  transition: background 0.1s ease;
}

.suggestion-favicon,
.suggestion-favicon-placeholder {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  flex-shrink: 0;
  border-radius: 3px;
}

.suggestion-favicon-placeholder {
  background-color: #eee;
}

.suggestion-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: #fae8e8; /* Primary */
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-name {
  font-weight: 600;
  color: #03345b; /* Secondary */
}

.suggestion-description {
  font-size: 0.875rem;
  color: #03345b; /* Secondary */
  opacity: 0.7;
  margin-top: 0.25rem;
}

.help-text {
  color: #03345b; /* Secondary */
  margin-bottom: 4rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
}

.feature {
  text-align: center;
  padding: 2rem;
  background: #fae8e8; /* Primary */
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.feature h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: #03345b; /* Secondary */
}

.feature p {
  color: #03345b; /* Secondary */
  opacity: 0.8;
}

/* Admin Styles */
.admin-page {
  background: #fffbf2; /* Background */
}

.login-page {
  background: #fffbf2; /* Background */
  min-height: 100vh;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-box {
  background: #fae8e8; /* Primary */
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  border: 1px solid #cddde7;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 2.25rem;
  color: #03345b; /* Secondary */
  margin-bottom: 0.5rem;
}

.login-header p {
  color: #03345b; /* Secondary */
  opacity: 0.8;
}

.login-form {
  margin-bottom: 2rem;
}

.login-help p {
  font-size: 0.875rem;
  color: #03345b; /* Secondary */
  margin-bottom: 1rem;
}

.security-note {
  background: #fffbf2; /* Background */
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid #a0c381; /* Accent */
}

/* Dashboard Styles */
.admin-dashboard {
  max-width: 1200px;
  margin: 0 auto;
}

.dashboard-header {
  margin-bottom: 3rem;
}

.dashboard-header h1 {
  font-size: 2.5rem;
  color: #03345b; /* Secondary */
  margin-bottom: 0.5rem;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: #fae8e8; /* Primary */
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  text-align: center;
  border: 1px solid #cddde7;
}

.stat-card h3 {
  font-size: 0.875rem;
  color: #03345b; /* Secondary */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #03345b; /* Secondary */
}

.stat-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: #03345b; /* Secondary */
}

.dashboard-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.section {
  background: #fae8e8; /* Primary */
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid #cddde7;
}

.section h2 {
  font-size: 1.25rem;
  color: #03345b; /* Secondary */
  margin-bottom: 1.5rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.top-links,
.recent-links {
  space-y: 1rem;
}

.top-link,
.recent-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid #cddde7; /* Accent */
}

.top-link:last-child,
.recent-link:last-child {
  border-bottom: none;
}

.link-name {
  font-weight: 600;
  color: #03345b; /* Secondary */
}

.link-clicks {
  color: #03345b; /* Secondary */
  opacity: 0.7;
  font-size: 0.875rem;
}

.link-info strong {
  color: #03345b; /* Secondary */
}

.link-info small {
  display: block;
  color: #03345b; /* Secondary */
  opacity: 0.7;
  font-size: 0.875rem;
}

.link-meta {
  text-align: right;
  font-size: 0.875rem;
  color: #03345b; /* Secondary */
  opacity: 0.7;
}

.links-table-streamlined th,
.links-table-streamlined td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.actions .btn-icon, .link-name .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  line-height: 1;
  border: 1px solid #03345b;
  border-radius: 6px;
}

.actions .btn-icon svg, .link-name .btn-icon svg {
  width: 16px;
  height: 16px;
}

.link-expires {
  display: block;
  margin-top: 0.25rem;
}

.no-data {
  color: #03345b; /* Secondary */
  opacity: 0.7;
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

.view-all-link {
  color: #03345b; /* Secondary */
  text-decoration: none;
  font-weight: 500;
  margin-top: 1rem;
  display: block;
}

.view-all-link:hover {
  text-decoration: underline;
  color: #a0c381; /* Accent */
}

/* Manage Links Styles */
.manage-links {
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2.5rem;
  color: #03345b; /* Secondary */
}

.links-table-container {
  background: #fae8e8; /* Primary */
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  border: 1px solid #cddde7;
}

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

.links-table th {
  background: #cddde7; /* Accent */
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #03345b; /* Secondary */
  border-bottom: 2px solid #a0c381;
}

.links-table td {
  padding: 1rem;
  vertical-align: top;
  color: #03345b;
}

.links-table tr {
  border-bottom: 1px solid #cddde7; /* Accent */
}

.links-table tr:hover {
  background: #fffbf2; /* Background */
}

.link-url {
  font-size: 0.875rem;
  color: #03345b; /* Secondary */
  opacity: 0.7;
  margin-top: 0.25rem;
}

.external-link {
  color: #03345b; /* Secondary */
  text-decoration: none;
}

.external-link:hover {
  text-decoration: underline;
  color: #a0c381;
}

.copy-link-name {
  color: #03345b; /* Secondary */
  text-decoration: none;
  cursor: pointer;
}

.copy-link-name:hover {
  text-decoration: underline;
  color: #a0c381; /* Accent */
}

.expired-badge {
  background: #dc3545;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
}

.no-links {
  text-align: center;
  padding: 4rem 2rem;
  color: #03345b; /* Secondary */
  opacity: 0.7;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 52, 91, 0.5); /* Secondary with alpha */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fffbf2; /* Background */
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid #cddde7;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #cddde7; /* Accent */
}

.modal-header h2 {
  margin: 0;
  color: #03345b; /* Secondary */
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #03345b; /* Secondary */
  opacity: 0.7;
}

.modal-close:hover {
  opacity: 1;
}

.link-form {
  padding: 1.5rem;
}

/* Error Page Styles */
.error-page {
  background: #fffbf2; /* Background */
  min-height: 100vh;
}

.error-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 2rem;
}

.error-content {
  background: #fae8e8; /* Primary */
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-width: 500px;
  border: 1px solid #cddde7;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: #a0c381; /* Accent */
}

.error-title {
  font-size: 2rem;
  color: #03345b; /* Secondary */
  margin-bottom: 1rem;
}

.error-message {
  font-size: 1.1rem;
  color: #03345b; /* Secondary */
  opacity: 0.8;
  margin-bottom: 2rem;
}

.error-advice {
  background: #fffbf2; /* Background */
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  text-align: left;
  border: 1px solid #cddde7;
}

.error-advice h3 {
  color: #03345b; /* Secondary */
  margin-bottom: 0.5rem;
}

.error-advice p {
  color: #03345b; /* Secondary */
  opacity: 0.8;
  margin: 0;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.error-code {
  font-size: 0.875rem;
  color: #cddde7; /* Accent */
  font-weight: 500;
}

/* Admin Tools */
.dashboard-footer {
  background: #fae8e8; /* Primary */
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid #cddde7;
}

.admin-tools h3 {
  color: #03345b; /* Secondary */
  margin-bottom: 1.5rem;
}

.tool-section {
  margin-bottom: 1.5rem;
}

.tool-section h4 {
  color: #03345b; /* Secondary */
  opacity: 0.7;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-form input {
  flex: 1;
  min-width: 200px;
}

/* QR Code Generation Page */
.generate-qr-page .qr-code-container {
  display: flex;
  gap: 2rem;
  background: #fae8e8; /* Primary */
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid #cddde7;
}

.generate-qr-page .qr-code-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #cddde7;
}

.generate-qr-page .qr-code-preview img {
  max-width: 100%;
  height: auto;
  display: block;
}

.generate-qr-page .qr-code-options {
  flex: 1;
  padding-left: 2rem;
  border-left: 1px solid #cddde7;
}

/* Color Palette for QR Generator */
.color-palette {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #cddde7;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(160, 195, 129, 0.4);
}

.color-swatch[data-color="#ffffff"] {
  border-color: #ddd;
}


/* Responsive Design */
@media (max-width: 992px) {
  .generate-qr-page .qr-code-container {
    flex-direction: column;
  }
  .generate-qr-page .qr-code-options {
    padding-left: 0;
    border-left: none;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #cddde7;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .hero-title {
    font-size: 3rem;
  }
  
  .nav {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-menu {
    order: -1;
  }
  
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
  
  .dashboard-sections {
    grid-template-columns: 1fr;
  }
  
  .page-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .links-table-container {
    overflow-x: auto;
  }
  
  .links-table {
    min-width: 800px;
  }
  
  .error-actions {
    flex-direction: column;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 2rem 0 4rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .login-box {
    padding: 2rem;
  }
  
  .error-content {
    padding: 2rem;
  }
  
  .modal-content {
    width: 95%;
  }
}

/* Loading States */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Focus States for Accessibility */
.btn:focus,
.form-input:focus,
.nav-link:focus,
.suggestion-item:focus {
  outline: 2px solid #a0c381; /* Accent */
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .header,
  .footer,
  .btn,
  .modal {
    display: none;
  }
  
  body {
    background: white;
  }
  
  .error-page,
  .login-page {
    background: white;
  }
}
