/* =============================================================
   Labelwin Web – Custom CSS
   Tailwind-Erweiterungen + eigene Komponenten-Klassen
   Primary: #1e40af (Blau)
   ============================================================= */

/* ── Basis ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #111827;
    line-height: 1.5;
}

/* Focus-Ring (Accessibility) */
:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Navigation ────────────────────────────────────────────────────────────── */
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #bfdbfe;       /* primary-200 */
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}
.nav-link:hover {
    background-color: #1d4ed8;   /* primary-700 */
    color: #fff;
}
.nav-link--active {
    background-color: #1d4ed8;
    color: #fff;
}

.mobile-nav-link {
    display: block;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #bfdbfe;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}
.mobile-nav-link:hover { background-color: #1d4ed8; color: #fff; }
.mobile-nav-link--active { background-color: #1d4ed8; color: #fff; }

.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.1s;
}
.dropdown-item:hover { background-color: #f3f4f6; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* btn-* auch standalone verwendbar (ohne .btn Basisklasse) */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background-color: #1e40af;
    color: #fff;
    border-color: #1e40af;
}
.btn-primary:hover:not(:disabled) { background-color: #1d4ed8; }

.btn-secondary {
    background-color: #fff;
    color: #374151;
    border-color: #d1d5db;
}
.btn-secondary:hover:not(:disabled) { background-color: #f9fafb; }

.btn-danger {
    background-color: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.btn-danger:hover:not(:disabled) { background-color: #b91c1c; }

.btn-ghost {
    background-color: transparent;
    color: #6b7280;
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background-color: #f3f4f6; color: #111827; }

.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    background-color: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    overflow: hidden;
    border-radius: 0.75rem 0.75rem 0 0;
}
.card-header h2, .card-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}
.card-body { padding: 1.25rem; }
.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
    overflow: hidden;
    border-radius: 0 0 0.75rem 0.75rem;
}

/* ── Stat-Karten ────────────────────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.stat-card__icon {
    width: 2.75rem; height: 2.75rem;
    border-radius: 0.625rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-card__label { font-size: 0.8125rem; color: #6b7280; font-weight: 500; }
.stat-card__value { font-size: 1.5rem; font-weight: 700; color: #111827; margin-top: 0.125rem; }
.stat-card__sub   { font-size: 0.75rem; color: #9ca3af; margin-top: 0.125rem; }

/* ── Formulare ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.3125rem;
}
.form-label--required::after { content: ' *'; color: #dc2626; }

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #111827;
    background-color: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-input--error { border-color: #dc2626; }
.form-input--error:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }
.form-error { font-size: 0.75rem; color: #dc2626; margin-top: 0.25rem; }
.form-hint  { font-size: 0.75rem; color: #6b7280;  margin-top: 0.25rem; }

.form-textarea { resize: vertical; min-height: 5rem; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 1.25rem; padding-right: 2.25rem; }

/* ── Tabelle ────────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.table th {
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
.table th.right, .table td.right { text-align: right; }
.table td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}
.table tbody tr:hover td { background-color: #f9fafb; }
.table tbody tr:last-child td { border-bottom: none; }

/* Sortierbare Spalte */
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: #1e40af; }

/* ── Badge / Status ─────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.badge-entwurf    { background-color: #f3f4f6; color: #6b7280; }
.badge-gesendet   { background-color: #dbeafe; color: #1d4ed8; }
.badge-angenommen { background-color: #d1fae5; color: #059669; }
.badge-abgelehnt  { background-color: #fee2e2; color: #dc2626; }
.badge-archiviert { background-color: #f3f4f6; color: #9ca3af; }

.badge-ang  { background-color: #eff6ff; color: #2563eb; }
.badge-best { background-color: #fef3c7; color: #d97706; }
.badge-ab   { background-color: #d1fae5; color: #059669; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.page-btn {
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.1s;
    min-width: 2rem;
    text-align: center;
}
.page-btn:hover:not(:disabled) { background-color: #f3f4f6; }
.page-btn--active { background-color: #1e40af; color: #fff; border-color: #1e40af; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-radius: 0.625rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    min-width: 260px;
    max-width: 360px;
    font-size: 0.875rem;
    line-height: 1.4;
    animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(1rem); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast-success { background: #fff; border-left: 4px solid #10b981; color: #065f46; }
.toast-error   { background: #fff; border-left: 4px solid #ef4444; color: #7f1d1d; }
.toast-info    { background: #fff; border-left: 4px solid #3b82f6; color: #1e3a8a; }
.toast-warning { background: #fff; border-left: 4px solid #f59e0b; color: #78350f; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 40;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    animation: backdrop-in 0.15s ease-out;
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: #fff;
    border-radius: 0.875rem;
    width: 100%;
    max-width: 28rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: modal-in 0.2s ease-out;
}
.modal-lg { max-width: 44rem; }
@keyframes modal-in {
    from { opacity: 0; transform: translateY(-1rem) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; font-weight: 600; margin: 0; }
.modal-body   { padding: 1.25rem; }
.modal-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    display: flex; justify-content: flex-end; gap: 0.5rem;
}

/* ── Loading ──────────────────────────────────────────────────────────────────── */
.spinner {
    width: 1.25rem; height: 1.25rem;
    border: 2px solid #e5e7eb;
    border-top-color: #1e40af;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: absolute; inset: 0;
    background: rgba(255,255,255,.7);
    display: flex; align-items: center; justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

/* ── Empty State ──────────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #9ca3af;
}
.empty-state__icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state__title { font-size: 1rem; font-weight: 600; color: #374151; margin-bottom: 0.25rem; }
.empty-state__text  { font-size: 0.875rem; }

/* ── Suchleiste ────────────────────────────────────────────────────────────────── */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}
.search-bar input {
    padding-left: 2.25rem;
    width: 100%;
}
.search-bar__icon {
    position: absolute;
    left: 0.625rem;
    color: #9ca3af;
    pointer-events: none;
    width: 1rem; height: 1rem;
}

/* ── Responsive Utilities ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .card-body   { padding: 1rem; }
    .card-header { padding: 0.875rem 1rem; }
    .table th,
    .table td    { padding: 0.625rem 0.75rem; }
}

/* ── Compat-Klassen (neuere Module) ───────────────────────────────────────────── */

/* input-field = Alias für form-input */
.input-field {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #111827;
    background-color: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}
.input-field:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.input-field[disabled], .input-field:disabled { background-color: #f9fafb; opacity: 0.7; cursor: not-allowed; }

/* btn-icon = kleiner Icon-Button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: background-color 0.1s, color 0.1s;
    text-decoration: none;
}
.btn-icon:hover:not(:disabled) { background-color: #f3f4f6; color: #111827; }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }

/* .th und .td für eigenständige Tabellen-Zellen */
.th {
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
.th.text-right, .td.text-right { text-align: right; }
.th.text-center, .td.text-center { text-align: center; }
.td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
    font-size: 0.875rem;
}

/* Erweiterte Badge-Farben */
.badge-green  { background-color: #d1fae5; color: #065f46; }
.badge-red    { background-color: #fee2e2; color: #dc2626; }
.badge-gray   { background-color: #f3f4f6; color: #6b7280; }
.badge-blue   { background-color: #dbeafe; color: #1d4ed8; }
.badge-purple { background-color: #ede9fe; color: #7c3aed; }
.badge-yellow { background-color: #fef3c7; color: #d97706; }

/* Tab-Buttons */
.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #374151; }
.tab-btn--active { border-bottom-color: #1e40af; color: #1e40af; }

/* Spinner klein */
.spinner--sm { width: 0.9rem; height: 0.9rem; border-width: 2px; }
