/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Flash Message Styles */
.flash {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  border-left: 4px solid;
  font-weight: 500;
}

.flash.notice {
  background-color: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.flash.alert {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.flash.error {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.flash.warning {
  background-color: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}
/* Breadcrumb Styles */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0 2rem;
  margin-bottom: 1rem;
  color: #6c757d;
}

.breadcrumbs .breadcrumb-link {
  color: #2845ae;
  text-decoration: none;
}

.breadcrumbs .breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumbs .breadcrumb-sep {
  color: #adb5bd;
  user-select: none;
}

.breadcrumbs .breadcrumb-current {
  color: #495057;
  font-weight: 600;
}

.login-link {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* Account Table Styles */
.account-row td {
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.account-row .account-name {
  font-weight: 500;
}

/* Status Badge Variants (global) */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: capitalize;
  vertical-align: middle;
  line-height: 1.2;
}
.status-badge.connected {
  background: #d4edda;
  color: #155724;
}
.status-badge.disconnected {
  background: #f8d7da;
  color: #721c24;
}
.status-badge.error {
  background: #fff3cd;
  color: #856404;
}
.status-badge.pending {
  background: #e3f2fd;
  color: #1976d2;
}

/* Entity Badge (global pill) */
.entity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 0;
  height: 2rem;
  line-height: 1.2;
  white-space: nowrap;
  gap: 0.5rem;
}
.entity-badge span:first-child {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.disconnected {
  background: #f3f4f6;
  color: #6b7280;
}

/* Disconnected account styling */
.disconnected-account {
  opacity: 0.7;
  background-color: #f9fafb;
}

.disconnected-account:hover {
  opacity: 1;
  background-color: #f3f4f6;
}

.disconnected-indicator {
  margin-left: 8px;
  font-size: 0.875rem;
  opacity: 0.7;
}

/* Admin nav styling */
.nav-admin-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  margin-left: 8px;
  border-left: 4px solid #b91c1c; /* red-700 */
  background: #fff1f2; /* rose-50 */
  border-radius: 14px;
}

.nav-admin-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #b91c1c; /* red-700 */
  letter-spacing: 0.03em;
}

.nav-admin-link {
  color: #7f1d1d; /* red-900 */
  font-weight: 600;
}

.nav-admin-link:hover {
  text-decoration: underline;
}

/* Bulk actions styling */
.bulk-actions {
  border-left: 4px solid #dc3545 !important;
}

.bulk-actions h5 {
  color: #dc3545;
  margin-bottom: 0.5rem;
}

/* Financial Institution Table Styles */
.financial-institution-row td {
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.financial-institution-row .financial-institution-name {
  font-weight: 500;
}

.financial-institution-row .financial-institution-domain {
  font-family: monospace;
  color: #666;
}

.financial-institution-row .financial-institution-accounts-count {
  text-align: center;
}

/* Common table styles */
.financial-institutions-table,
.accounts-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.financial-institutions-table th,
.accounts-table th {
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid #ddd;
  font-weight: 600;
}

.pagy {
  display: flex;
  font-family: sans-serif;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: rgb(107 114 128);
  & > :not([hidden]) ~ :not([hidden]) {
    --space-reverse: 0;
    margin-right: calc(0.25rem * var(--space-reverse));
    margin-left: calc(0.25rem * calc(1 - var(--space-reverse)));
  }

  a:not(.gap) {
    display: block;
    text-decoration: none;
    border-radius: 0.5rem;
    background-color: rgb(229 231 235);
    padding: 0.25rem 0.75rem;
    color: inherit;
    &:hover {
      background-color: rgb(209 213 219);
    }
    &:not([href]) { /* disabled links */
      cursor: default;
      background-color: rgb(243 244 246);
      color: rgb(209 213 219);
    }
    &.current {
      background-color: rgb(156 163 175);
      color: rgb(255 255 255);
    }
  }

  label {
    white-space: nowrap;
    display: inline-block;
    border-radius: 0.5rem;
    background-color: rgb(229 231 235);
    padding: 0.125rem 0.75rem;
    input {
      line-height: 1.5rem;
      border-radius: 0.375rem;
      border-style: none;
      background-color: rgb(243 244 246);
    }
  }
}

/* App-wide polished UI primitives inspired by account show */
.app-page,
.accounts-index,
.entities-index,
.csv-import-files-index,
.dashboard,
.admin-users-index,
.admin-signup-white-lists-index {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem 1rem;
}

.app-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.app-page-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  color: #111827;
}

.app-page-subtitle {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.84rem;
}

.app-page-actions {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.app-surface {
  background: #f8fafc;
  border: 1px solid #e5e9f0;
  border-radius: 14px;
  box-shadow: none;
}

.app-collapsible-header-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-collapsible .section-header,
.app-collapsible .cf-section-header {
  position: relative;
}

.app-collapsible .section-header,
.app-collapsible .cf-section-header {
  padding-right: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e6ebf2;
  min-height: 2rem;
}

.app-collapsible .section-actions,
.app-collapsible .cf-section-actions {
  margin-right: 2.25rem;
}

.app-collapsible-toggle {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.app-collapsible .app-collapsible-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
}

.app-collapsible-toggle:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
  color: #312e81;
}

.app-collapsible-toggle:focus-visible {
  outline: 2px solid #2845ae;
  outline-offset: 1px;
}

.app-collapsible-toggle-icon {
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

.app-collapsible-toggle-icon.is-collapsed {
  transform: rotate(-90deg);
}

.app-collapsible.is-collapsed .section-header,
.app-collapsible.is-collapsed .cf-section-header {
  margin-bottom: 0;
}

.app-collapsible > [data-collapsible-section-target="content"] > .cf-list,
.app-collapsible > [data-collapsible-section-target="content"] > .app-table-surface {
  border-top: 0;
}

.app-table-surface {
  border: 1px solid #e5e9f0;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: none;
}

.app-empty-state {
  text-align: center;
  padding: 2rem 1.25rem;
  background: #f8fafc;
  border: 1px dashed #dbe4f0;
  border-radius: 14px;
}

.app-empty-state h3 {
  margin: 0.35rem 0;
  color: #334155;
  font-size: 1.05rem;
}

.app-empty-state p {
  margin: 0.35rem 0 1rem;
  color: #64748b;
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.42rem 0.8rem;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: #2845ae;
  border-color: #2845ae;
  color: #fff;
}

.btn-primary:hover {
  background: #223b95;
  border-color: #223b95;
  box-shadow: 0 1px 3px rgba(40, 69, 174, 0.22);
}

.btn-secondary {
  background: #334155;
  border-color: #334155;
  color: #fff;
}

.btn-secondary:hover {
  background: #1f2937;
  border-color: #1f2937;
}

.btn-outline-primary {
  background: #fff;
  border-color: #c9d5f4;
  color: #2845ae;
}

.btn-outline-primary:hover {
  background: #eef2ff;
  border-color: #aec0ef;
  color: #1f378d;
}

.btn-outline-secondary {
  background: #fff;
  border-color: #d0d7e2;
  color: #475569;
}

.btn-outline-secondary:hover {
  background: #f8fafc;
  border-color: #c1cad7;
  color: #334155;
}

.btn-outline-danger {
  background: #fff;
  border-color: #f2c9cf;
  color: #bb2d3b;
}

.btn-outline-danger:hover {
  background: #fff5f5;
  border-color: #e9acb4;
  color: #a61f2f;
}

.btn-sm {
  min-height: 30px;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
}

#quiltt-button {
  margin-bottom: 0;
  background: #1f3ca2;
  color: #fff;
  border: 1px solid #1f3ca2;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.42rem 0.8rem;
  min-height: 34px;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#quiltt-button:hover {
  background: #1a3288;
  border-color: #1a3288;
  box-shadow: 0 1px 3px rgba(31, 60, 162, 0.22);
}

.account-avatar-with-source {
  position: relative;
  overflow: visible;
}

.account-source-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}

.account-source-badge i {
  font-size: 0.5rem;
}

.account-source-badge-lg {
  width: 18px;
  height: 18px;
  right: -4px;
  bottom: -4px;
}

.account-source-badge-lg i {
  font-size: 0.6rem;
}

.account-source-badge-xl {
  width: 20px;
  height: 20px;
  right: -4px;
  bottom: -4px;
}

.account-source-badge-xl i {
  font-size: 0.65rem;
}

.account-source-badge-manual,
.account-source-badge-connected {
  background: #2563eb;
}

.flash {
  max-width: 1280px;
  margin: 0 auto 0.75rem;
}

@media (max-width: 768px) {
  .app-page,
  .accounts-index,
  .entities-index,
  .csv-import-files-index,
  .dashboard,
  .admin-users-index,
  .admin-signup-white-lists-index {
    padding: 0 0.75rem 0.75rem;
  }
}