/* ============================================================================
   card_table_modal.css — Cards, Tabellen, Modals (Tech / Glass Design)
   ============================================================================ */

/* ---------------------------
 * Cards (Basis & Layout)
 * --------------------------- */

/* Basis-Container für alle Karten */
.card {
  background: rgba(255, 255, 255, 0.85); /* Helles Milchglas */
  backdrop-filter: blur(12px);           /* Der Blur-Effekt */
  -webkit-backdrop-filter: blur(12px);   /* Safari Support */
  
  border: 1px solid rgba(0, 0, 0, 0.08); /* Sehr feiner grauer Rahmen */
  border-radius: 12px;                   /* Moderner Radius */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02); /* Sehr subtiler Schatten */
  padding: 20px;
  position: relative;
}

/* Header Card (Sticky Toolbar Style) */
.header-card {
  width: 100%;
  padding: 12px 24px; /* Schlanker */
  margin-bottom: 24px;

  position: sticky;
  top: 100px; /* Muss zum App-Header passen */
  z-index: 900;

  /* Sehr helles, fast weißes Glas */
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  
  /* Nur unten ein Rahmen für Struktur */
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  
  /* Subtiler Schatten */
  box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.03);
  
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-card__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #1e293b;
  /* Kleiner blauer Akzent-Strich links */
  border-left: 4px solid var(--color-info);
  padding-left: 12px;
  line-height: 1.1;
}

.header-card__divider {
  height: 1px;
  background: linear-gradient(to right, #e2e8f0, transparent);
  margin: 12px 0;
}

.header-card__desc {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
  padding-left: 16px; /* Einrückung passend zum Titel */
}


/* Layout Helfer */
.card-grid {
  display: grid;
  gap: 20px;
  margin-top: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.col {
  flex: 1;
  min-width: 240px;
}

.mt-12 { margin-top: 12px; }

/* ---------------------------
 * Interaktive Cards (Links) - STANDARD (BLAU/TECH)
 * --------------------------- */
.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  
  /* Standard Tech Look: Hell, leicht bläulicher Rahmen */
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.15); /* Hauch von Blau im Rahmen */
  backdrop-filter: blur(5px);
  border-radius: 12px;
  padding: 20px;
  
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-link__title {
  margin: 0 0 8px;
  /* Tech-Typografie */
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  font-weight: 700;
  color: #475569; /* Slate Grau */
  transition: color 0.2s;
}

.card-link__desc {
  margin: 0;
  font-weight: 500;
  color: #1e293b;
  font-size: 0.95rem;
}

/* Hover für Standard-Cards: Blauer Tech-Glow */
.card-link:hover {
  transform: translateY(-2px);
  background: #ffffff;
  
  /* Der "Glow" Effekt in Blau */
  border-color: #3b82f6; 
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 8px 20px rgba(0,0,0,0.05);
}

.card-link:hover .card-link__title {
  color: #2563eb; /* Titel wird leuchtend Blau */
}

/* ---------------------------
 * Admin-Card (Spezifisch: ROT/WARNUNG)
 * --------------------------- */
/* Deine gewünschte Variante 3 */
.admin-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(139, 0, 0, 0.2); /* Etwas transparenter für besseren Blend */
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.admin-card .card-link__title {
  color: #991b1b; 
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.admin-card .card-link__desc {
  color: #333;
  font-weight: 500;
}

/* Hover für Admin-Card: Roter Tech-Glow */
.admin-card.card-link:hover {
  border-color: #ef4444; /* Helles Rot */
  background: #fff;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15), 0 8px 20px rgba(139, 0, 0, 0.1);
  transform: translateY(-2px);
}

.admin-card.card-link:hover .card-link__title {
  color: #dc2626;
}


/* ---------------------------
 * Tabellen (Excel-Style / Clean)
 * --------------------------- */
.table-wrap {
  overflow: auto;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.9rem;
}

.table th,
.table td {
  border: 1px solid rgba(0,0,0,0.1);
  padding: 8px 12px;
  vertical-align: middle;
  line-height: 1.3;
}

.table thead th {
  background: #f8fafc; /* Sehr helles Grau */
  color: #334155;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.table tbody tr:hover {
  background: #f1f5f9;
}

/* Sticky Helpers */
.table--sticky-head thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.table--sticky-firstcol tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fafafa;
}

.table--sticky-firstcol.table--sticky-head thead th:first-child {
  left: 0;
  z-index: 4;
}

.perm-route-header__rot{
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

/* Permission Toggle */
.perm-emoji-toggle { display: inline-block; }
.perm-emoji-toggle input { display: none; }

.perm-emoji-toggle label{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  background: transparent;
  border: none;
  opacity: 0.7;
  transition: all 0.2s;
}

.perm-emoji-toggle label::before{
  content: '✕';
  color: #ef4444;
}

.perm-emoji-toggle input:checked + label::before{
  content: '✓';
  color: #10b981;
}

.perm-emoji-toggle label:hover{
  opacity: 1;
  transform: scale(1.2);
}

/* ---------------------------
 * Modals (Zentral)
 * --------------------------- */
.modal{
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  padding: 20px;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal__dialog{
  width: min(600px, 100%);
  background: #ffffff;
  color: #1f2937;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0,0,0,0.1);
  overflow: hidden;
  transform: scale(1);
  animation: modalPopIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPopIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal__header{
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display:flex;
  align-items:center;
  justify-content:space-between;
  background: #f8fafc;
}

.modal__title{
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0;
  color: #334155;
}

.modal__body{
  padding: 20px;
}

.modal__footer{
  padding: 16px 20px;
  border-top: 1px solid #f1f5f9;
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  background: #f8fafc;
}

/* Varianten */
.modal--danger .modal__dialog{
  border-color: #fecaca;
}
.modal--danger .modal__header {
  background: #fef2f2;
  color: #991b1b;
}

.modal--dark .modal__dialog{
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
}
.modal--dark .modal__header,
.modal--dark .modal__footer {
  background: #0f172a;
  border-color: #334155;
}
.modal--dark .modal__title { color: #fff; }

/* ---------------------------
 * Cookie Modal
 * --------------------------- */
.cookie-modal__overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cookie-modal__overlay.hidden { display: none; }

.cookie-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: min(500px, 100%);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  border: 1px solid rgba(0,0,0,0.1);
}

.cookie-modal__header {
  padding: 16px 24px;
  border-bottom: 1px solid #f1f5f9;
}

.cookie-modal__title { margin: 0; font-size: 1.2rem; font-weight: 800; }

.cookie-modal__content { padding: 24px; overflow-y: auto; }

.cookie-modal__actions {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

/* ---------------------------
 * DB Browser (Tabellen-Editing)
 * --------------------------- */
.db-table{ font-family: var(--mono); font-size: 0.85rem; }

.db-table td[contenteditable="true"]{
  outline: none;
  cursor: text;
  transition: background 0.2s;
}

.db-table td.editable-cell:focus{
  background: rgba(59, 130, 246, 0.1);
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.db-table td.is-modified{
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
}

.db-table .pk-icon{
  font-size: 0.75em;
  color: #d97706;
  margin-left: 6px;
}

.db-table-actions{ width: 56px; text-align: center; }

.db-table-save{
  display: none;
  padding: 4px 8px;
  font-size: 0.75rem;
}

.db-table-summary{
  cursor: pointer;
  font-weight: 700;
  color: #334155;
}
.db-table-body{ margin-top: 10px; }
details[data-db-table-details="1"].card{
  margin: 0 0 10px;
  box-shadow: none;
  background: rgba(255,255,255,0.5);
}

/* Permissions Tabs */
.perm-tab-btn--active {
  background: var(--color-success) !important;
  border-color: var(--color-success) !important;
  color: #fff !important;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

/* ---------------------------
 * Admin Settings / User Selection
 * --------------------------- */
.user-selection-details {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.user-selection-details summary {
    cursor: pointer;
    font-weight: 700;
    padding: 12px 20px;
    background: #f8fafc;
    color: #334155;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.user-selection-details summary:hover {
    background-color: #f1f5f9;
}

.user-selection-details summary::after {
    content: '\f078'; 
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #94a3b8;
    transition: transform 0.3s ease;
}

.user-selection-details[open] summary::after {
    transform: rotate(180deg);
}

.user-selection-details summary::-webkit-details-marker { display: none; }

.user-selection-content {
    padding: 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
    background: #fff;
}
