/* Admin Panel Styles for Factfind */

/* Font Faces - Local Fonts */
@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/baloo-2-v21-latin-regular.woff2') format('woff2'),
    url('../fonts/baloo-2-v21-latin-regular.woff') format('woff'),
    url('../fonts/baloo-2-v21-latin-regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/baloo-2-v21-latin-500.woff2') format('woff2'),
    url('../fonts/baloo-2-v21-latin-500.woff') format('woff'),
    url('../fonts/baloo-2-v21-latin-500.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/baloo-2-v21-latin-600.woff2') format('woff2'),
    url('../fonts/baloo-2-v21-latin-600.woff') format('woff'),
    url('../fonts/baloo-2-v21-latin-600.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/baloo-2-v21-latin-700.woff2') format('woff2'),
    url('../fonts/baloo-2-v21-latin-700.woff') format('woff'),
    url('../fonts/baloo-2-v21-latin-700.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/baloo-2-v21-latin-800.woff2') format('woff2'),
    url('../fonts/baloo-2-v21-latin-800.woff') format('woff'),
    url('../fonts/baloo-2-v21-latin-800.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v40-latin-300.woff2') format('woff2'),
    url('../fonts/open-sans-v40-latin-300.woff') format('woff'),
    url('../fonts/open-sans-v40-latin-300.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v40-latin-regular.woff2') format('woff2'),
    url('../fonts/open-sans-v40-latin-regular.woff') format('woff'),
    url('../fonts/open-sans-v40-latin-regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v40-latin-500.woff2') format('woff2'),
    url('../fonts/open-sans-v40-latin-500.woff') format('woff'),
    url('../fonts/open-sans-v40-latin-500.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v40-latin-600.woff2') format('woff2'),
    url('../fonts/open-sans-v40-latin-600.woff') format('woff'),
    url('../fonts/open-sans-v40-latin-600.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v40-latin-700.woff2') format('woff2'),
    url('../fonts/open-sans-v40-latin-700.woff') format('woff'),
    url('../fonts/open-sans-v40-latin-700.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v40-latin-800.woff2') format('woff2'),
    url('../fonts/open-sans-v40-latin-800.woff') format('woff'),
    url('../fonts/open-sans-v40-latin-800.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* Base styles */
body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-family: 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.login-card {
  background: rgba(230, 58, 140, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 1.5rem;
  padding: 3rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

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

.login-logo img {
  max-width: 200px;
  height: auto;
}

.login-title {
  text-align: center;
  color: #fff;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.login-subtitle {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2rem;
}

.login-form .form-group {
  margin-bottom: 1.5rem;
}

.login-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #fff;
}

.login-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 0.5rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
}

.login-button {
  width: 100%;
  margin-top: 1rem;
}

.login-footer {
  margin-top: 2rem;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
}

.login-links {
  margin-top: 1.5rem;
  text-align: center;
}

.totp-input {
  font-size: 1.5rem !important;
  text-align: center;
  letter-spacing: 0.5rem;
  font-weight: 600;
}

/* 2FA Setup */
.setup-2fa-card {
  max-width: 500px;
}

.setup-2fa-content {
  text-align: center;
}

.setup-instructions {
  margin-bottom: 1.5rem;
  color: #666;
}

.qr-code-container {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f5f5f5;
  border-radius: 0.5rem;
  display: inline-block;
}

.qr-code {
  max-width: 200px;
  height: auto;
}

.manual-key {
  margin: 1.5rem 0;
}

.secret-key {
  display: block;
  background: #f5f5f5;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-family: monospace;
  font-size: 0.9rem;
  word-break: break-all;
  margin-top: 0.5rem;
}

/* Alerts */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.alert-error {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
}

.alert-success {
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.3);
  color: #28a745;
}

/* Admin Navigation */
.admin-nav {
  background: rgba(230, 58, 140, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-brand img {
  height: 40px;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.3s;
}

.nav-link:hover {
  opacity: 0.8;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-name {
  color: #fff;
  font-weight: 500;
}

/* Admin Main */
.admin-page {
  background: #f5f5f5;
  min-height: 100vh;
}

.admin-main {
  padding: 2rem 0;
}

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

.admin-header h1 {
  color: #3f2774;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  border-radius: 1rem;
  text-align: center;
  background: rgba(230, 58, 140, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: #fff;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-weight: 500;
  opacity: 0.8;
}

/* Admin Sections */
.admin-section {
  background: rgba(230, 58, 140, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  color: #fff;
}

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

.section-header h2 {
  margin: 0;
}

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

/* Tables */
.table-responsive {
  overflow: hidden;
  background: #fff;
  border-radius: 1rem;
  margin-top: 1.5rem;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-table th,
.admin-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: #333;
}

.admin-table th {
  background: rgba(0, 0, 0, 0.02);
  font-weight: 600;
  color: #3f2774;
}

.admin-table th:first-child {
  border-top-left-radius: 1rem;
}

.admin-table th:last-child {
  border-top-right-radius: 1rem;
}

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

.admin-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 1rem;
}

.admin-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 1rem;
}

.admin-table tr:hover {
  background: rgba(230, 58, 140, 0.05);
}

.actions-cell {
  white-space: nowrap;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-submitted {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

.status-viewed {
  background: rgba(255, 193, 7, 0.1);
  color: #856404;
}

.status-pending {
  background: rgba(108, 117, 125, 0.1);
  color: #6c757d;
}

/* Buttons */
.btn-icon {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.7;
  transition: opacity 0.3s, color 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.btn-icon svg {
  stroke: currentColor;
}

.btn-icon:hover {
  opacity: 1;
  color: #e63a8c;
}

.btn-danger:hover {
  color: #dc3545;
}

/* Inline SVG Icons */
.status-enabled svg,
.status-disabled svg,
.settings-warning svg {
  vertical-align: middle;
  margin-right: 0.25rem;
}

.status-enabled svg {
  stroke: #28a745;
}

.status-disabled svg,
.settings-warning svg {
  stroke: #f0ad4e;
}

.success-icon svg {
  stroke: #28a745;
}

/* Empty States */
.empty-state {
  color: #666;
  text-align: center;
  padding: 2rem;
}

.empty-state-large {
  text-align: center;
  padding: 4rem 2rem;
  background: #fff;
  border-radius: 1rem;
}

.empty-state-large h3 {
  color: #3f2774;
  margin-bottom: 0.5rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.page-info {
  color: #666;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: #fff;
  padding: 2rem;
  border-radius: 1rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s ease;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.modal-close:hover {
  background: rgba(230, 58, 140, 0.1);
  transform: rotate(90deg);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  stroke: #666;
}

.modal-close:hover svg {
  stroke: #e63a8c;
}

.modal-content h2 {
  padding-right: 2rem;
  color: #3f2774;
}

.modal-form .form-group {
  margin-bottom: 1.5rem;
}

.modal-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
}

.modal-form input,
.modal-form select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.modal-form input:focus,
.modal-form select:focus {
  outline: none;
  border-color: #e63a8c;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.link-display {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.link-display input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid #e63a8c;
  border-radius: 0.5rem;
  font-size: 0.9rem;
}

/* Settings */
.settings-grid {
  display: grid;
  gap: 2rem;
}

.settings-card {
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.settings-card h2 {
  color: #3f2774;
  margin-bottom: 1rem;
}

.settings-info p {
  margin-bottom: 0.5rem;
}

.settings-warning {
  color: #856404;
  background: rgba(255, 193, 7, 0.1);
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.key-display {
  display: flex;
  gap: 0.5rem;
}

.key-display input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 0.5rem;
  font-family: monospace;
}

.status-enabled {
  color: #28a745;
  font-weight: 600;
}

.status-disabled {
  color: #856404;
  font-weight: 600;
}

.disable-2fa-form {
  margin-top: 1rem;
}

/* View Submission */
.submission-meta {
  background: #f5f5f5;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
}

.submission-meta p {
  margin: 0.25rem 0;
}

.encryption-prompt {
  max-width: 500px;
  margin: 0 auto;
}

.key-form .form-group {
  margin-bottom: 1.5rem;
}

.key-input {
  font-family: monospace;
}

.submission-data {
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-actions {
  margin-bottom: 2rem;
}

.data-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.data-section:last-child {
  border-bottom: none;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.data-item {
  padding: 0.5rem 0;
}

.data-item.full-width {
  grid-column: 1 / -1;
}

.data-label {
  font-weight: 600;
  color: #3f2774;
  display: block;
  margin-bottom: 0.25rem;
}

.data-value {
  color: #333;
}

.data-raw {
  background: #f5f5f5;
  padding: 1.5rem;
  border-radius: 0.5rem;
}

/* Form Page */
.form-page {
  background: #fff;
  min-height: 100vh;
}

.form-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.form-header {
  background: linear-gradient(262deg, #3f2774 0%, #e63a8c 100%);
  padding: 1.5rem 0;
}

.form-main {
  flex: 1;
  padding: 3rem 0;
}

.form-intro {
  text-align: center;
  margin-bottom: 3rem;
}

.form-intro h1 {
  color: #3f2774;
}

.form-footer {
  background: #f5f5f5;
  padding: 1.5rem 0;
  text-align: center;
  color: #666;
}

/* Factfind Form */
.factfind-form {
  max-width: 800px;
  margin: 0 auto;
}

.form-section {
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #eee;
}

.section-title {
  color: #3f2774;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e63a8c;
}

.subsection-title {
  color: #666;
  font-size: 0.95rem;
  margin: 1.5rem 0 1rem;
}

.radio-options--horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.radio-options--inline {
  display: inline-flex;
  gap: 1.5rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.form-row {
  display: grid;
  gap: 1rem;
}

.form-row--4col {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.form-actions {
  text-align: center;
  margin-top: 2rem;
}

.button--large {
  padding: 1.25rem 3rem !important;
  font-size: 1.1rem;
}

.consent-section {
  background: rgba(230, 58, 140, 0.05);
  border-color: #e63a8c;
}

/* Success/Error boxes */
.success-message,
.success-box,
.error-box {
  text-align: center;
  padding: 3rem;
}

.success-icon,
.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.success-icon {
  color: #28a745;
}

.success-message {
  background: rgba(40, 167, 69, 0.05);
  border-radius: 1rem;
  border: 1px solid rgba(40, 167, 69, 0.2);
}

/* Print styles */
@media print {

  .admin-nav,
  .data-actions,
  .btn-icon {
    display: none !important;
  }

  .admin-main {
    padding: 0;
  }

  .submission-data {
    box-shadow: none;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .admin-nav .container {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 1rem;
    font-size: 0.9rem;
  }

  .admin-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .login-card {
    padding: 2rem;
  }

  .form-section {
    padding: 1.5rem;
  }

  .form-row--4col {
    grid-template-columns: 1fr 1fr;
  }
}