/**
 * Trustee Views Shared Styles
 */

/* Loading & Error */
.loading,
.error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  font-size: 0.9375rem;
}

.error {
  color: var(--error-color, #dc2626);
}

/* List View */
.listView {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.primaryButton {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--primary-color, #2563eb);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.primaryButton:hover {
  background: var(--primary-hover, #1d4ed8);
}

.secondaryButton {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color, #d0d0d0);
  border-radius: 6px;
  background: var(--bg-primary, #ffffff);
  color: var(--text-primary, #1a1a1a);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.secondaryButton:hover {
  background: var(--surface-color, #f5f5f5);
}

/* Data Table */
.dataTable {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  overflow: hidden;
}

.dataTable th,
.dataTable td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.dataTable th {
  background: var(--surface-color, #f8f9fa);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--text-secondary, #666);
}

.dataTable td {
  font-size: 0.875rem;
  color: var(--text-primary, #1a1a1a);
}

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

.dataTable tbody tr:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.02));
}

/* Actions Column */
.actions {
  display: flex;
  gap: 0.25rem;
}

.iconButton {
  padding: 0.375rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.iconButton:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.05));
}

.iconButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badgeSuccess {
  background: var(--success-light, #dcfce7);
  color: var(--success-color, #16a34a);
}

.badgeWarning {
  background: var(--warning-light, #fef9c3);
  color: var(--warning-color, #ca8a04);
}

/* Empty State */
.emptyState {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 2rem;
  background: var(--surface-color, #f8f9fa);
  border: 2px dashed var(--border-color, #e0e0e0);
  border-radius: 8px;
}

.emptyState p {
  margin: 0;
  color: var(--text-secondary, #666);
  font-size: 0.9375rem;
}

/* Dashboard View */
.dashboardView {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.statCard {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 12px;
}

.statIcon {
  font-size: 2rem;
}

.statContent {
  flex: 1;
}

.statValue {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #1a1a1a);
}

/* Kompakte Variante für Text-Werte wie Rollen */
.statValueSmall {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary, #1a1a1a);
  line-height: 1.4;
}

.statLabel {
  font-size: 0.8125rem;
  color: var(--text-secondary, #666);
}

.infoSection {
  padding: 1.25rem;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 12px;
}

.infoSection h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
}

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

.infoItem {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.infoLabel {
  font-size: 0.75rem;
  color: var(--text-tertiary, #888);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.infoValue {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary, #1a1a1a);
}

/* Dark Theme */
:global(.dark-theme) .dataTable {
  background: var(--surface-dark, #1a1a1a);
  border-color: var(--border-dark, #333);
}

:global(.dark-theme) .dataTable th {
  background: var(--surface-dark, #2a2a2a);
  color: var(--text-secondary-dark, #aaa);
}

:global(.dark-theme) .dataTable th,
:global(.dark-theme) .dataTable td {
  border-bottom-color: var(--border-dark, #333);
}

:global(.dark-theme) .dataTable td {
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .dataTable tbody tr:hover {
  background: var(--hover-bg-dark, rgba(255, 255, 255, 0.03));
}

:global(.dark-theme) .secondaryButton {
  background: var(--surface-dark, #1a1a1a);
  border-color: var(--border-dark, #444);
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .secondaryButton:hover {
  background: var(--surface-dark, #2a2a2a);
}

:global(.dark-theme) .iconButton:hover {
  background: var(--hover-bg-dark, rgba(255, 255, 255, 0.1));
}

:global(.dark-theme) .emptyState {
  background: var(--surface-dark, #1a1a1a);
  border-color: var(--border-dark, #444);
}

:global(.dark-theme) .emptyState p {
  color: var(--text-secondary-dark, #aaa);
}

:global(.dark-theme) .statCard,
:global(.dark-theme) .infoSection {
  background: var(--surface-dark, #1a1a1a);
  border-color: var(--border-dark, #333);
}

:global(.dark-theme) .statValue,
:global(.dark-theme) .statValueSmall,
:global(.dark-theme) .infoSection h3,
:global(.dark-theme) .infoValue {
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .statLabel {
  color: var(--text-secondary-dark, #aaa);
}

:global(.dark-theme) .infoLabel {
  color: var(--text-tertiary-dark, #888);
}

/* Modal */
.modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: var(--bg-primary, #ffffff);
  border-radius: 12px;
  padding: 1.5rem;
  min-width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideIn 0.2s ease-out;
}

.modal h3 {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
}

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

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

/* Utility Classes */
.muted {
  color: var(--text-tertiary, #888);
  font-style: italic;
}

.monospace {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
}

.truncate {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alignRight {
  text-align: right;
}

.alignCenter {
  text-align: center;
}

/* Form Styles (für Phase 3) */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.formField {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.formField label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary, #666);
}

.formField input,
.formField select,
.formField textarea {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border-color, #d0d0d0);
  border-radius: 6px;
  font-size: 0.9375rem;
  color: var(--text-primary, #1a1a1a);
  background: var(--bg-primary, #ffffff);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.formField input:focus,
.formField select:focus,
.formField textarea:focus {
  outline: none;
  border-color: var(--primary-color, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.formField input:disabled,
.formField select:disabled {
  background: var(--surface-color, #f5f5f5);
  cursor: not-allowed;
}

.formActions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #e0e0e0);
}

.formError {
  padding: 0.75rem;
  background: var(--error-light, #fee2e2);
  border: 1px solid var(--error-color, #dc2626);
  border-radius: 6px;
  color: var(--error-color, #dc2626);
  font-size: 0.875rem;
}

/* Dark Theme - Modal */
:global(.dark-theme) .modal {
  background: var(--surface-dark, #1a1a1a);
  border: 1px solid var(--border-dark, #333);
}

:global(.dark-theme) .modal h3 {
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .muted {
  color: var(--text-tertiary-dark, #666);
}

:global(.dark-theme) .formField label {
  color: var(--text-secondary-dark, #aaa);
}

:global(.dark-theme) .formField input,
:global(.dark-theme) .formField select,
:global(.dark-theme) .formField textarea {
  background: var(--surface-dark, #2a2a2a);
  border-color: var(--border-dark, #444);
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .formField input:disabled,
:global(.dark-theme) .formField select:disabled {
  background: var(--surface-dark, #1a1a1a);
}

:global(.dark-theme) .formActions {
  border-top-color: var(--border-dark, #333);
}

/* Instance Roles View */
.rolesList {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.roleCard {
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  overflow: hidden;
}

.roleHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.roleHeader:hover {
  background: var(--surface-color, #f8f9fa);
}

.roleInfo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.expandIcon {
  color: var(--text-secondary, #666);
  font-size: 0.75rem;
}

.roleLabel {
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
}

.roleDescription {
  color: var(--text-secondary, #666);
  font-size: 0.875rem;
}

.roleBadges {
  display: flex;
  gap: 0.5rem;
}

.systemBadge {
  padding: 0.25rem 0.5rem;
  background: var(--info-light, #e0f2fe);
  color: var(--info-color, #0284c7);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.roleContent {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color, #e0e0e0);
  background: var(--surface-color, #f8f9fa);
}

.infoBox {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: var(--info-light, #e0f2fe);
  border: 1px solid var(--info-color, #0284c7);
  border-radius: 6px;
  margin-bottom: 1rem;
  color: var(--info-color, #0284c7);
  font-size: 0.875rem;
}

.emptyIcon {
  font-size: 3rem;
  color: var(--text-tertiary, #999);
  margin-bottom: 1rem;
}

.emptyHint {
  font-size: 0.875rem;
  color: var(--text-tertiary, #999);
  margin-top: 0.5rem;
}

.retryButton {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--primary-color, #3b82f6);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  margin-top: 1rem;
}

.retryButton:hover {
  background: var(--primary-dark, #2563eb);
}

/* Dark Theme - Instance Roles */
:global(.dark-theme) .roleCard {
  background: var(--surface-dark, #1a1a1a);
  border-color: var(--border-dark, #333);
}

:global(.dark-theme) .roleHeader:hover {
  background: var(--surface-dark, #2a2a2a);
}

:global(.dark-theme) .roleLabel {
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .roleDescription {
  color: var(--text-secondary-dark, #aaa);
}

:global(.dark-theme) .roleContent {
  background: var(--surface-dark, #2a2a2a);
  border-top-color: var(--border-dark, #333);
}

:global(.dark-theme) .infoBox {
  background: var(--info-dark, #0c4a6e);
  border-color: var(--info-color, #0284c7);
  color: var(--info-light, #e0f2fe);
}

/* =============================================================================
 * Expense Import View Styles
 * ============================================================================= */

.expenseImportSection {
  max-width: 800px;
}

.sectionTitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
  margin-bottom: 0.5rem;
}

.sectionDescription {
  color: var(--text-secondary, #666);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  position: relative;
}

/* Info Icon and Tooltip */
.infoIcon {
  display: inline-block;
  margin-left: 0.5rem;
  color: var(--info-color, #0284c7);
  cursor: pointer;
  font-size: 1rem;
  vertical-align: middle;
  transition: color 0.2s;
}

.infoIcon:hover {
  color: var(--primary-color, #3b82f6);
}

.infoTooltip {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--info-light, #e0f2fe);
  border: 1px solid var(--info-color, #0284c7);
  border-radius: 8px;
  padding: 1rem;
  color: var(--info-color, #0c4a6e);
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.2s ease-out;
}

.infoTooltip strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
}

.infoTooltip ul {
  margin: 0;
  padding-left: 1.25rem;
}

.infoTooltip li {
  margin-bottom: 0.375rem;
  line-height: 1.5;
}

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

:global(.dark-theme) .infoTooltip {
  background: var(--info-dark, #0c4a6e);
  border-color: var(--info-color, #0284c7);
  color: var(--info-light, #e0f2fe);
}

.setupStep {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.stepNumber {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--primary-color, #3b82f6);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.875rem;
}

.stepContent {
  flex: 1;
}

.stepContent h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
  margin: 0 0 0.75rem 0;
}

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

.connectedIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--success-light, #dcfce7);
  color: var(--success-color, #16a34a);
  border-radius: 50%;
  font-weight: bold;
  font-size: 0.75rem;
}

.connectedText {
  color: var(--text-primary, #1a1a1a);
}

.folderSelect {
  width: 100%;
  max-width: 400px;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 6px;
  font-size: 0.9375rem;
  background: var(--bg-primary, #ffffff);
  color: var(--text-primary, #1a1a1a);
  margin-bottom: 0.75rem;
}

.folderSelect:focus {
  outline: none;
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.activateDescription {
  color: var(--text-secondary, #666);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.loadingText {
  color: var(--text-secondary, #666);
  font-style: italic;
}

.errorMessage {
  padding: 0.75rem 1rem;
  background: var(--error-light, #fef2f2);
  border: 1px solid var(--error-color, #dc2626);
  border-radius: 6px;
  color: var(--error-color, #dc2626);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.successMessage {
  padding: 0.75rem 1rem;
  background: var(--success-light, #dcfce7);
  border: 1px solid var(--success-color, #16a34a);
  border-radius: 6px;
  color: var(--success-color, #16a34a);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.infoBox h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.infoBox ul {
  margin: 0;
  padding-left: 1.25rem;
}

.infoBox li {
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Folder Browser */
.folderBrowser {
  margin-top: 0.5rem;
}

.folderList {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 6px;
  background: var(--bg-primary, #ffffff);
}

.folderItem {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.folderItem:last-child {
  border-bottom: none;
}

.folderItem:hover {
  background: var(--surface-color, #f8f9fa);
}

.folderName {
  flex: 1;
  color: var(--text-primary, #1a1a1a);
  font-size: 0.875rem;
}

.folderName:hover {
  color: var(--primary-color, #3b82f6);
}

.selectButton {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--primary-color, #3b82f6);
  border-radius: 4px;
  background: transparent;
  color: var(--primary-color, #3b82f6);
  font-size: 0.75rem;
  cursor: pointer;
}

.selectButton:hover {
  background: var(--primary-color, #3b82f6);
  color: white;
}

.emptyText {
  padding: 1rem;
  text-align: center;
  color: var(--text-secondary, #666);
  font-style: italic;
}

.selectedFolderText {
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: var(--success-light, #dcfce7);
  border-radius: 4px;
  color: var(--success-color, #16a34a);
  font-size: 0.875rem;
}

/* Dark Theme - Folder Browser */
:global(.dark-theme) .folderList {
  background: var(--surface-dark, #2a2a2a);
  border-color: var(--border-dark, #333);
}

:global(.dark-theme) .folderItem {
  border-bottom-color: var(--border-dark, #333);
}

:global(.dark-theme) .folderItem:hover {
  background: var(--surface-dark, #333);
}

:global(.dark-theme) .folderName {
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .selectedFolderText {
  background: var(--success-dark, #052e16);
  color: var(--success-light, #dcfce7);
}

/* Dark Theme - Expense Import */
:global(.dark-theme) .sectionTitle {
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .sectionDescription,
:global(.dark-theme) .activateDescription {
  color: var(--text-secondary-dark, #aaa);
}

:global(.dark-theme) .setupStep {
  background: var(--surface-dark, #1a1a1a);
  border-color: var(--border-dark, #333);
}

:global(.dark-theme) .stepContent h4 {
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .connectedText {
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .folderSelect {
  background: var(--surface-dark, #2a2a2a);
  border-color: var(--border-dark, #333);
  color: var(--text-primary-dark, #ffffff);
}

:global(.dark-theme) .errorMessage {
  background: var(--error-dark, #450a0a);
  color: var(--error-light, #fef2f2);
}

:global(.dark-theme) .successMessage {
  background: var(--success-dark, #052e16);
  color: var(--success-light, #dcfce7);
}
