/* assets/styles.css */

/* 1. Basis-Design / Theme */
:root {
    --color-bg: #0f172a;
    --color-bg-soft: #111827;
    --color-bg-card: #111827;
    --color-bg-input: #020617;
    --color-border-subtle: #1f2937;
    --color-text: #e5e7eb;
    --color-text-muted: #9ca3af;
    --color-accent: #2563eb;
    --color-accent-soft: rgba(37, 99, 235, 0.15);
    --color-danger: #ef4444;
    --radius-card: 14px;
    --radius-pill: 999px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.7);
    --transition-fast: 0.15s ease-out;
    --font-base: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-base);
    background: radial-gradient(circle at top, #1d283a 0, #020617 45%, #000 100%);
    color: var(--color-text);
}

/* 2. Layout-Container */

.app-shell {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* 3. Top-Navigation */

.top-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
    background: linear-gradient(to right, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.96));
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
    padding: 0.55rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-nav-title {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #bfdbfe;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.top-nav-title-badge {
    font-size: 0.7rem;
    padding: 0 0.55rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(96, 165, 250, 0.7);
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 60%);
    color: #dbeafe;
}

.top-nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 1rem;
    flex-wrap: wrap;
}

.top-nav-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.top-nav-links a:hover {
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    border-color: rgba(55, 65, 81, 0.9);
    transform: translateY(-1px);
}

.top-nav-links a.nav-primary {
    background: linear-gradient(135deg, var(--color-accent), #4f46e5);
    color: white;
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.55);
}

.top-nav-links a.nav-primary:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.7);
}

.top-nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 4. Globale Suche in Top-Navigation */

.top-nav-search input {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: linear-gradient(to right, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.96));
    color: var(--color-text);
    min-width: 140px;
}

.top-nav-search input::placeholder {
    color: rgba(148, 163, 184, 0.8);
}

.top-nav-user {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

/* 5. Cards, Buttons, Inputs */

.card {
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), rgba(15, 23, 42, 0.98));
    border-radius: var(--radius-card);
    border: 1px solid rgba(31, 41, 55, 0.9);
    box-shadow: var(--shadow-soft);
    padding: 1.1rem 1.2rem;
}

.card + .card {
    margin-top: 1rem;
}

.card-title {
    margin: 0 0 0.4rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.card-subtitle {
    margin: 0 0 0.8rem 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.1rem;
}

@media (min-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(30, 64, 175, 0.4));
    color: #e5e7eb;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn:hover {
    border-color: rgba(129, 140, 248, 0.9);
    background: linear-gradient(145deg, rgba(30, 64, 175, 0.9), rgba(37, 99, 235, 0.9));
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.65);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(55, 65, 81, 0.9);
}

.btn-secondary:hover {
    border-color: rgba(148, 163, 184, 0.9);
    background: rgba(15, 23, 42, 1);
}

.btn-danger {
    background: linear-gradient(145deg, #b91c1c, #dc2626);
    border-color: rgba(239, 68, 68, 0.9);
}

.btn-sm {
    font-size: 0.78rem;
    padding: 0.35rem 0.8rem;
}

/* Inputs / Forms */

form label {
    display: block;
    margin-top: 0.6rem;
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    max-width: 360px;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(31, 41, 55, 0.95);
    background: var(--color-bg-input);
    color: var(--color-text);
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

textarea {
    min-height: 130px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.7);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.7);
}

/* 6. Tabellen */

.table-wrapper {
    margin-top: 0.75rem;
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1px solid rgba(31, 41, 55, 0.9);
    box-shadow: var(--shadow-soft);
    background: rgba(15, 23, 42, 0.95);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th,
td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: rgba(15, 23, 42, 0.9);
}

tbody tr:nth-child(odd) {
    background: rgba(15, 23, 42, 0.9);
}

tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.98);
}

tbody tr:hover {
    background: rgba(30, 64, 175, 0.17);
}

/* 7. Status, Badges, Hinweise */

.status {
    margin: 0.5rem 0;
    font-size: 0.8rem;
}

.status-ok {
    color: #bbf7d0;
}

.status-error {
    color: var(--color-danger);
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: rgba(15, 23, 42, 0.95);
    color: var(--color-text-muted);
}

.badge-green {
    border-color: rgba(34, 197, 94, 0.7);
    color: #bbf7d0;
}

.badge-red {
    border-color: rgba(239, 68, 68, 0.8);
    color: #fecaca;
}

.badge-blue {
    border-color: rgba(59, 130, 246, 0.8);
    color: #bfdbfe;
}

/* 8. Spezielle Layouts */

.page-centered {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.page-title {
    margin: 0 0 0.4rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.page-subtitle {
    margin: 0 0 1rem 0;
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

/* 9. Pagination */

.pagination {
    margin-top: 0.9rem;
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

.pagination a {
    text-decoration: none;
}

/* 10. Scannerbereich */

.scanner-container {
    margin-top: 0.8rem;
    border-radius: var(--radius-card);
    border: 1px solid rgba(31, 41, 55, 0.95);
    background: radial-gradient(circle at top, rgba(79, 70, 229, 0.35), rgba(15, 23, 42, 0.98));
    padding: 0.9rem;
    box-shadow: var(--shadow-soft);
}

.scanner-status {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.4rem;
}

.hidden {
    display: none;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), rgba(15, 23, 42, 0.98));
    border-radius: 16px;
    border: 1px solid rgba(31, 41, 55, 0.95);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
    max-width: 640px;
    width: 100%;
    padding: 1rem 1.2rem 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
}

.modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 .1rem;
}

.modal-close:hover {
    color: #e5e7eb;
}

.modal-body {
    margin-top: .25rem;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .75rem;
}

.modal-text {
    margin: 0;
    font-family: inherit;
    font-size: .9rem;
    white-space: pre-wrap;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 10px;
    padding: .75rem;
    border: 1px solid rgba(31, 41, 55, 0.9);
    max-height: 50vh;
    overflow: auto;
}

.modal-footer {
    margin-top: .75rem;
    display: flex;
    justify-content: flex-end;
}

/* -----------------------------------
   Mobile-Optimierung (bis 640px breit)
   ----------------------------------- */
@media (max-width: 640px) {
    /* Grundlayout enger machen */
    .main-content {
        padding: 0.9rem;
    }

    .page-title {
        font-size: 1.05rem;
        margin-bottom: 0.2rem;
    }

    .page-subtitle {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .card {
        padding: 0.85rem 0.9rem;
        border-radius: 12px;
        box-shadow: 0 14px 32px rgba(0, 0, 0, 0.8);
    }

    .card-grid {
        grid-template-columns: 1fr; /* immer einspaltig auf Mobile */
        gap: 0.8rem;
    }

    /* Buttons: breiter und besser tappbar */
    .btn {
        font-size: 0.85rem;
        padding: 0.55rem 0.9rem;
        min-height: 40px;
    }

    .btn-sm {
        font-size: 0.8rem;
        padding: 0.45rem 0.8rem;
        min-height: 36px;
    }

    /* Top-Navigation: untereinander statt gequetscht nebeneinander */
    .top-nav {
        padding: 0.5rem 0.75rem;
    }

    .top-nav-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .top-nav-links {
        margin-left: 0;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.15rem;
    }

    .top-nav-right {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .top-nav-search input {
        width: 100%;
        min-width: 0;
    }

    .top-nav-user {
        font-size: 0.75rem;
    }

    /* Tabellen: etwas kompakter + horizontales Scrollen sauber */
    .table-wrapper {
        margin-top: 0.6rem;
        border-radius: 10px;
        overflow-x: auto;
    }

    table {
        font-size: 0.8rem;
        min-width: 100%; /* verhindert „zusammengedrückt“ */
    }

    th,
    td {
        padding: 0.45rem 0.6rem;
    }

    /* Pagination etwas kompakter */
    .pagination {
        margin-top: 0.7rem;
        font-size: 0.78rem;
    }

    /* Scanner-Bereich: schön mittig, nicht zu viel Padding */
    .scanner-container {
        padding: 0.75rem;
        margin-top: 0.7rem;
    }

    .scanner-status {
        font-size: 0.78rem;
    }
}

/* Notizzeilen besser tappbar machen */
.note-row {
    cursor: pointer;
    touch-action: manipulation;
}

.note-row:hover {
    background: rgba(37, 99, 235, 0.18);
}

.note-row:active {
    background: rgba(37, 99, 235, 0.3);
}
