/* Custom Password Manager Styles */

:root {
  --primary-color: #667eea;
  --primary-dark: #5568d3;
  --primary-light: #7c93f5;
  --secondary-color: #764ba2;
  --accent-color: #f093fb;
  --success-color: #4ade80;
  --danger-color: #f87171;
  --warning-color: #fbbf24;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
  --bg-white: #ffffff;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* General Layout & Page Header */
.page-title {
  width: 100%;
  text-align: left;
  margin-bottom: 1.5rem;
  font-size: 2rem;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.controls-right .btn {
  height: 50px; /* Explicitly set a fixed height */
  line-height: 1; /* Normalize line-height for consistent vertical alignment */
  min-width: 150px; /* Set a minimum width for all buttons */
  justify-content: center; /* Center the content within the button */
}

.header-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex: 1;
}

/* Navbar Styles */
.navbar {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  width: 100%;
  max-width: 1200px;
  padding: 0 2rem;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  margin: 0;
}

.navbar .btn {
  border-radius: 8px;
  padding: 0.625rem 1.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.navbar .btn-light {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border: none;
}

.navbar .btn-light:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

.navbar-collapse {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
}

.navbar-toggler {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary-color);
}

/* Container Styles */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Card Styles */
.card {
  background: var(--bg-white);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  border: none;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.card-body {
  padding: 3rem;
}

.card-title {
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2rem;
  text-align: center;
  font-size: 1.75rem;
}

/* Form Styles */
.form-label {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  display: block;
  text-align: left;
}

.form-control {
  border: 2px solid var(--border-color);
  border-radius: 10px;
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: var(--bg-light);
  width: 100%;
  display: block;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: white;
  outline: none;
}

.password-input-wrapper .form-control {
  padding-right: 3.5rem;
}

.form-control.password-field {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', monospace;
  letter-spacing: 1px;
  font-size: 0.95rem;
  padding-right: 6rem; /* More padding for two buttons */
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: white;
  outline: none;
}

/* Password Input Wrapper with Inline Buttons */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-icon-inline {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.password-input-wrapper .btn-icon-inline {
  position: absolute;
}

.btn-icon-inline:hover {
  color: var(--primary-color);
  background: rgba(102, 126, 234, 0.1);
}

.btn-icon-inline:active {
  transform: scale(0.95);
}

.btn-icon-inline svg {
  width: 16px;
  height: 16px;
}

/* Position toggle button (show/hide) */
.toggle-password-btn {
  right: 2.5rem;
}

.toggle-password-btn .icon-hide {
  display: none;
}

/* Position copy button */
.password-input-wrapper .copy-btn {
  right: 0.5rem;
}

/* Specific fix for login page where there is only one button */
.password-input-wrapper:not(:has(.copy-btn)) .toggle-password-btn {
  right: 0.5rem;
}


/* Form Checkbox (Remember Me) */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-check-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.form-check-label {
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.input-group {
  display: flex;
  width: 100%;
  align-items: stretch;
}

.input-group .form-control {
  border-right: none;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  flex: 1;
}

.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  flex-shrink: 0;
}

/* Button Styles */
.btn {
  border-radius: 10px;
  padding: 0.875rem 2rem;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border: 2px solid transparent; /* Add transparent border to match height of outline buttons */
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, var(--success-color));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #10b981);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 2px solid var(--border-color);
}

.btn-outline-secondary:hover {
  background: white;
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 8px;
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
  border-radius: 12px;
}

.d-grid {
  display: grid;
  width: 100%;
}

.d-grid .btn {
  width: 100%;
}

/* Table Styles */
.table-container {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  overflow-x: auto;
  overflow-y: visible;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.table thead {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.table thead th {
  color: white;
  font-weight: 600;
  padding: 0.75rem 1rem;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
  border: none;
  text-align: center;
  vertical-align: middle;
}

.table thead th:first-child {
  border-top-left-radius: 10px;
  text-align: left;
  padding-left: 1.5rem;
}

.table thead th:last-child {
  border-top-right-radius: 10px;
  text-align: center;
  padding-right: 1.5rem;
}

.table tbody tr {
  transition: all 0.3s ease;
  border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
  background: var(--bg-light);
  transform: scale(1.005);
}

.table tbody td {
  padding: 0.5rem 1rem;
  vertical-align: middle;
  text-align: center;
}

.table tbody td:first-child {
  text-align: left;
  padding-left: 1.5rem;
}

.table tbody td:last-child {
  text-align: center;
  padding-right: 1.5rem;
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 10px;
}

.table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 10px;
}

.th-checkbox {
  width: 50px;
}

/* Toggle Button Styles */
.toggle-btn {
  font-size: 1.25rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-light);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-btn:hover {
  background: white;
  border-color: var(--primary-color);
  transform: scale(1.1);
}

/* Delete Link Styles */
.table .delete-link {
  color: var(--danger-color);
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: inline-block;
}

.table .delete-link:hover {
  background: #fee2e2;
  color: #dc2626;
}

.table .edit-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.table .edit-link:hover {
  background: rgba(102, 126, 234, 0.1);
}

/* Heading Styles */
h1, h2, h3, h4 {
  color: var(--text-dark);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  width: 100%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

/* Text Center */
.text-center {
  text-align: center;
}

/* Welcome Page Styles */
.welcome-container {
  background: white;
  border-radius: 20px;
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-xl);
  max-width: 550px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.welcome-container h1 {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  font-size: 2rem;
}

.welcome-container p {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Flash Messages */
.flash-message {
  background: #fef3c7;
  border-left: 4px solid var(--warning-color);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  color: #92400e;
  font-weight: 500;
}

.flash-message.error {
  background: #fee2e2;
  border-left-color: var(--danger-color);
  color: #991b1b;
}

.flash-message.success {
  background: #d1fae5;
  border-left-color: var(--success-color);
  color: #065f46;
}

.flash-message.info {
  background: #e0e7ff;
  border-left-color: var(--primary-color);
  color: #3730a3;
}

/* Validation Styles */
.invalid-feedback {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: none;
}

.was-validated .form-control:invalid ~ .invalid-feedback {
  display: block;
}

.was-validated .form-control:invalid {
  border-color: var(--danger-color);
}

.was-validated .form-control:valid {
  border-color: var(--success-color);
}

/* Utility Classes */
.mb-3 {
  margin-bottom: 1.25rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.mt-3 {
  margin-top: 1.25rem;
}

.gap-2 {
  gap: 0.75rem;
}

.gap-3 {
  gap: 1.25rem;
}

.d-flex {
  display: flex;
  align-items: center;
}

.justify-content-center {
  justify-content: center;
}

.justify-content-end {
  justify-content: flex-end;
}

.row {
  width: 100%;
}

.align-items-center {
  align-items: center;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 auto;
  width: 100%;
  justify-content: center;
}

/* Responsive Design */
@media (min-width: 768px) {
  .col-md-4 {
    flex: 0 0 33.333333%;
  }

  .navbar-collapse {
    display: flex !important;
  }

  .navbar-toggler {
    display: none;
  }
}

@media (max-width: 767px) {
  /* Navbar mobile adjustments */
  .navbar-collapse {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    box-shadow: var(--shadow-md);
  }
  
  .navbar .container {
    flex-wrap: wrap;
    padding: 0 1rem;
  }

  .navbar .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .navbar-toggler {
    display: block;
  }

  /* Container adjustments */
  .container {
    padding: 1rem 0.5rem;
  }

  /* Table adjustments */
  .table-container {
    overflow-x: auto;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 600px;
    font-size: 0.875rem;
  }

  .table thead th {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
  }

  .table tbody td {
    padding: 0.5rem 0.5rem;
  }

  .table tbody td:first-child {
    padding-left: 0.75rem;
  }

  .table tbody td:last-child {
    padding-right: 0.75rem;
  }

  /* Headings */
  h2 {
    font-size: 1.25rem;
    padding: 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  /* Cards */
  .card-body {
    padding: 1.5rem;
  }

  .card {
    max-width: 100%;
    margin: 0 0.5rem;
  }

  /* Welcome container */
  .welcome-container {
    padding: 2rem 1.5rem;
    margin: 0 0.5rem;
  }

  .welcome-container h1 {
    font-size: 1.5rem;
  }

  .welcome-container p {
    font-size: 0.95rem;
  }

  /* Buttons */
  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }

  /* Modal adjustments */
  .modal-content {
    padding: 2rem 1.5rem;
    max-width: 90%;
    margin: 0 1rem;
  }

  .modal-content h3 {
    font-size: 1.25rem;
  }

  .modal-content p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }

  .modal-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .modal-buttons .btn {
    max-width: 100%;
    width: 100%;
  }

  /* Form inputs */
  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Password field */
  .form-control.password-field {
    font-size: 0.875rem;
  }

  /* Empty state */
  .empty-state {
    padding: 2rem 1.5rem;
    margin: 0 0.5rem;
  }

  .empty-state p {
    font-size: 1rem;
  }
}

/* Very small devices (landscape phones, less than 576px) */
@media (max-width: 575px) {
  .table {
    min-width: 550px;
    font-size: 0.8rem;
  }

  .table thead th,
  .table tbody td {
    padding: 0.5rem 0.25rem;
  }

  .btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.8rem;
  }

  .toggle-btn {
    font-size: 1rem;
  }
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card, .table-container, h2 {
  animation: fadeIn 0.5s ease-out;
}

.modal {
  display: none; /* Hidden by default */
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 3rem;
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-state p {
  color: var(--text-light);
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
}

/* Modal Styles */
.modal-content {
  background: white;
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  max-width: 450px;
  width: 90%;
  text-align: center;
  animation: slideIn 0.3s ease-out;
}

.modal-content h3 {
  color: var(--text-dark);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.modal-content p {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.modal-subtext {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

.modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.modal-buttons .btn {
  flex: 1;
  max-width: 150px;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, var(--danger-color));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  padding: 1rem 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  font-weight: 600;
  font-size: 1rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- New Classes from Refactoring --- */

/* Search Bar */
.search-bar {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1rem;
  width: 280px;
  max-width: 280px;
  min-width: 200px;
}
.search-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  padding: 0;
  background: transparent;
}
.search-count {
  color: var(--text-light);
  font-size: 0.85rem;
  white-space: nowrap;
}
.clear-search-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 0.25rem;
}

/* Dropdown Menu */
.dropdown-wrapper {
  position: relative;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 1000;
  overflow: hidden;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  color: var(--text-dark);
  text-decoration: none;
  transition: background 0.2s;
}
.dropdown-item:hover {
  background: var(--bg-light);
}
.dropdown-item:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}
.dropdown-item-text {
  font-weight: 500;
}

/* Bulk Actions Bar */
#bulkActionsBar {
  display: none;
  background: var(--primary-color);
  color: white;
  padding: 1rem;
  border-radius: 12px 12px 0 0;
  margin-bottom: -1px;
}
.bulk-actions-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#selectedCount {
  font-weight: 600;
}
.bulk-actions-buttons {
  display: flex;
  gap: 1rem;
}
#deselectAllBtn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-weight: 500;
}

/* Table Specifics */
.table-checkbox {
  cursor: pointer;
  width: 18px;
  height: 18px;
}
.site-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Align items to the start of the cell */
  gap: 0.75rem; /* Gap between favicon and site-info */
  text-align: left; /* Ensure text inside is left-aligned */
}
.site-favicon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
}
.site-favicon-default {
  flex-shrink: 0;
}
.site-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.site-name {
  /* No longer needs to be flexible */
}
.category-badges {
  display: flex;
  gap: 0.3rem;
  margin-left: 0.5rem;
}
.category-badge {
  background-color: #eef2ff;
  color: #4338ca;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.text-with-copy {
  display: flex;
  align-items: center;
  position: relative;
  gap: 0.5rem;
}
.text-value {
  flex: 1;
}
.action-buttons {
  display: inline-flex;
  gap: 0.5rem;
  justify-content: center;
}
.action-link {
  font-size: 0.95rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
}
.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eef2ff; /* Default background for Edit button */
  color: var(--primary-color); /* Default icon color for Edit button */
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-icon-action.delete-btn {
  background: #fee2e2; /* Default background for Delete button */
  color: var(--danger-color); /* Default icon color for Delete button */
}

.btn-icon-action:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn-icon-action.delete-btn:hover {
  background: var(--danger-color);
}

.no-fields-placeholder {
  color: var(--text-light);
  font-size: 0.9rem;
}
.fields-container {
  display: none;
}

/* Additional Field Value Input */
.additional-field-value-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.view-fields-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}
.view-fields-btn:hover {
  background: var(--primary-dark);
}

/* --- Modal Enhancements --- */
.modal {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(31, 41, 55, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-lg {
  max-width: 600px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
  margin-bottom: 0;
  text-align: left;
}
.modal-close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 0 0.5rem;
}
.modal-body {
  max-height: 60vh;
  overflow-y: auto;
  margin: -0.5rem; /* Counteract padding on items */
  padding: 0.5rem;
}
.additional-field-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.additional-field-label {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.85rem;
}

/* Other */
.link-primary {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

/* --- Final Additions from Template Cleanup --- */

/* Form headers and descriptions */
.form-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.form-text-description {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

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

/* Add/Edit additional fields */
.additional-field-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: flex-start;
}
.additional-field-row input:first-child {
  flex: 1;
}
.additional-field-row input:nth-child(2) {
  flex: 2;
}
.additional-field-row .remove-field-btn {
  padding: 0.4rem 0.75rem;
}

/* Verification screen styles */
.verification-icon {
  margin-bottom: 1rem;
}
.verification-header {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}
.verification-text {
  color: var(--text-light);
  font-size: 0.95rem;
}
.verification-button {
  flex: 1;
}

/* Import page styles */
.import-notes {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}
.import-notes-header {
  color: #d97706;
  margin-bottom: 0.5rem;
}
.import-notes-list {
  margin: 0;
  padding-left: 1.5rem;
  font-size: 0.9rem;
  color: #92400e;
}
.import-notes-list li {
  margin-bottom: 0.25rem;
}
.import-example-box {
  background: var(--bg-light);
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}
.import-example-header {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}
.import-example-pre {
  background: white;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  overflow-x: auto;
  margin: 0;
  white-space: pre;
  word-wrap: normal;
}
.import-example-pre code {
  background: none;
  padding: 0;
  font-family: monospace;
  font-size: 1em;
}

/* Search Highlight */
.search-highlight {
  background-color: #fef08a; /* A pleasant yellow */
  color: var(--text-dark);
  border-radius: 3px;
  padding: 0 2px;
}
}

/* --- Category Management Page --- */
.category-management-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.category-management-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}
.category-management-item:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}
.category-info {
  display: flex;
  flex-direction: column;
}
.category-name {
  font-weight: 600;
  font-size: 1.1rem;
}
.category-count {
  font-size: 0.85rem;
  color: var(--text-light);
}
.category-actions {
  display: flex;
  gap: 0.5rem;
}
.rename-form {
  display: none;
  gap: 0.5rem;
}
.category-actions.editing .rename-form {
  display: flex;
}
.category-actions.editing .start-rename,
.category-actions.editing > form:not(.rename-form) {
  display: none;
}

/* --- Tag Input Component --- */
.tag-input-wrapper {
  position: relative; /* This is the fix */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  background: var(--bg-light);
  cursor: text;
  transition: all 0.3s ease;
}
.tag-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: white;
}
.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag-pill {
  display: flex;
  align-items: center;
  background-color: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
}
.tag-close {
  margin-left: 0.5rem;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}
.tag-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
  min-width: 150px;
}
.suggestion-box {
  display: none;
  position: absolute;
  top: 100%; /* Position it right below the wrapper */
  left: 0;
  right: 0; /* Make it span the full width */
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  margin-top: 0.5rem;
  margin-top: 0.25rem;
  max-height: 150px;
  overflow-y: auto;
  z-index: 1050; /* Ensure it's above other elements */
}
.suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
}
.suggestion-item:hover {
  background: var(--bg-light);
}
