/* ============================================================
   Keybuki Hinweisgeberschutz — Melder-Frontend
   ============================================================ */

:root {
    --primary: #C73178;
    --primary-dark: #a82865;
    --primary-light: #fdf0f5;
    --primary-hover: #b52c6c;
    --secondary: #53275e;
    --secondary-light: #7b3d8a;
    --secondary-dark: #381641;
    --accent: #e10020;
    --accent-light: #ffeef0;
    --success: #28a745;
    --success-light: #d4edda;
    --warning: #f59e0b;
    --warning-light: #fff3cd;
    --danger: #e10020;
    --danger-light: #f8d7da;
    --info: #0073aa;
    --info-light: #d1ecf1;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #404040;
    --gray-900: #1f2937;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fffbfb;
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 620px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.header .subtitle {
    font-size: 15px;
    color: var(--gray-500);
}

.logo {
    max-height: 48px;
    margin-bottom: 12px;
}

.btn-back {
    position: absolute;
    left: 0;
    top: 4px;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 15px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.btn-back:hover {
    background: var(--primary-light);
}

.fall-id-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
}

/* Cards */
.card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    border: 1px solid var(--gray-200);
}

.welcome-card {
    text-align: center;
}

.shield-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.welcome-text {
    font-size: 15px;
    color: var(--gray-600);
    max-width: 480px;
    margin: 0 auto 20px;
}

.card-intro {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* Trust Badges */
.trust-badges {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 13px;
    color: var(--gray-600);
}

.badge-icon {
    font-size: 14px;
}

/* Buttons */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 150ms ease;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    width: 100%;
}

.btn-copy {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
}

.btn-copy:hover {
    background: var(--gray-100);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    color: var(--gray-800);
    background: #fff;
    transition: border-color 150ms ease;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(199, 49, 120, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.hint {
    display: block;
    font-size: 13px;
    color: var(--gray-400);
    margin-top: 4px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500 !important;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.kontakt-felder {
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.kontakt-felder .form-group:last-child {
    margin-bottom: 0;
}

.divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 24px 0;
}

/* Error */
.error-msg {
    padding: 12px 16px;
    background: var(--danger-light);
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 14px;
    margin-bottom: 16px;
}

.error-card {
    text-align: center;
    padding: 40px 24px;
}

.error-card h2 {
    color: var(--danger);
    margin-bottom: 8px;
}

/* Erfolg */
.erfolg-card {
    text-align: center;
}

.erfolg-icon {
    width: 64px;
    height: 64px;
    background: var(--success);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin: 0 auto 16px;
}

.erfolg-text {
    font-size: 16px;
    color: var(--gray-600);
    margin-bottom: 24px;
}

.credentials-box {
    background: var(--primary-light);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.credentials-box h3 {
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.credentials-hint {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.credential-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}

.credential-row:last-child {
    border-bottom: none;
}

.credential-label {
    font-size: 14px;
    color: var(--gray-500);
    min-width: 80px;
}

.credential-value {
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    flex: 1;
}

.info-box {
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    text-align: left;
}

.info-box p {
    font-size: 14px;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.erfolg-card .actions {
    flex-direction: row;
    justify-content: center;
}

.erfolg-card .actions .btn {
    width: auto;
    flex: 1;
}

/* Status */
.status-card {
    padding: 16px 20px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

.status-row:last-child {
    border-bottom: none;
}

.status-label {
    color: var(--gray-500);
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.status-neu { background: var(--primary-light); color: var(--primary); }
.status-bearbeitung { background: var(--warning-light); color: var(--warning); }
.status-ermittlung { background: #fef3c7; color: #92400e; }
.status-abgeschlossen { background: var(--success-light); color: var(--success); }
.status-abgewiesen { background: var(--gray-100); color: var(--gray-500); }

/* Nachrichten */
.nachrichten-card h2 {
    font-size: 17px;
    margin-bottom: 16px;
}

.nachrichten-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.keine-nachrichten {
    text-align: center;
    color: var(--gray-400);
    padding: 24px;
    font-size: 14px;
}

.nachricht {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    max-width: 85%;
}

.nachricht-melder {
    background: var(--primary);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.nachricht-bearbeiter {
    background: var(--gray-100);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
}

.nachricht-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
    opacity: 0.7;
}

.nachricht-text {
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.nachricht-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.nachricht-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: none;
}

.nachricht-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(199, 49, 120, 0.12);
}

.nachricht-form .btn {
    padding: 10px 20px;
    white-space: nowrap;
}

.fall-geschlossen {
    text-align: center;
    color: var(--gray-400);
    font-size: 14px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.footer p {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 4px;
}

/* Loading */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 16px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen p {
    font-size: 14px;
    color: var(--gray-400);
}

/* Utilities */
.hidden { display: none !important; }

/* Print */
@media print {
    body { background: #fff; }
    .btn, .btn-back, .footer, .nachricht-form { display: none !important; }
    .container { max-width: 100%; padding: 20px; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    .credentials-box { border: 2px solid #000; }
}

/* Mobile */
@media (max-width: 480px) {
    .container { padding: 16px 12px 32px; }
    .card { padding: 18px 16px; }
    .trust-badges { flex-direction: column; align-items: center; }
    .credential-row { flex-wrap: wrap; }
    .erfolg-card .actions { flex-direction: column; }
    .nachricht { max-width: 92%; }
    .header h1 { font-size: 20px; }
}