/* ═══════════════════════════════════════
   ATipPortal – Design System
   EU-Hinweisgeber-Richtlinie konform
   ═══════════════════════════════════════ */

:root {
    --primary: #1a56db;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

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

html, body { height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlazorS, sans-serif;
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.6;
}

/* Loading */
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; color: var(--gray-500); }
.loading-spinner { width: 40px; height: 40px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }
.app-header { background: var(--primary-dark); color: white; padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; height: 56px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.app-header a { color: white; text-decoration: none; }
.app-header .brand { font-weight: 700; font-size: 1.125rem; display: flex; align-items: center; gap: .5rem; }
.app-header nav { display: flex; gap: 0.25rem; }
.app-header nav a { padding: .5rem .75rem; border-radius: var(--radius); transition: background .15s; font-size: .875rem; }
.app-header nav a:hover, .app-header nav a.active { background: rgba(255,255,255,.15); }
.app-main { flex: 1; padding: 2rem; max-width: 1200px; width: 100%; margin: 0 auto; }
.app-footer { text-align: center; padding: 1rem; color: var(--gray-500); font-size: .75rem; border-top: 1px solid var(--gray-200); }

/* Cards */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.card-header { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--gray-200); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .375rem; padding: .5rem 1rem; border-radius: var(--radius); border: 1px solid transparent; font-size: .875rem; font-weight: 500; cursor: pointer; transition: all .15s; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: .25rem .625rem; font-size: .8125rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .375rem; font-size: .875rem; color: var(--gray-700); }
.form-control { width: 100%; padding: .5rem .75rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: .875rem; transition: border-color .15s, box-shadow .15s; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; }

/* Alerts / Badges */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); }
.alert-success { background: var(--success-light); color: #065f46; }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-danger { background: var(--danger-light); color: #991b1b; }
.badge { display: inline-flex; align-items: center; padding: .125rem .5rem; border-radius: 9999px; font-size: .75rem; font-weight: 600; }
.badge-new { background: var(--primary-light); color: var(--primary-dark); }
.badge-confirmed { background: #e0e7ff; color: #3730a3; }
.badge-progress { background: var(--warning-light); color: #92400e; }
.badge-closed { background: var(--success-light); color: #065f46; }
.badge-rejected { background: var(--gray-200); color: var(--gray-700); }
.badge-overdue { background: var(--danger-light); color: #991b1b; }
.badge-priority-low { background: var(--gray-100); color: var(--gray-500); }
.badge-priority-medium { background: var(--warning-light); color: #92400e; }
.badge-priority-high { background: #fed7aa; color: #9a3412; }
.badge-priority-critical { background: var(--danger-light); color: #991b1b; }

/* Tables */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; padding: .625rem .75rem; border-bottom: 1px solid var(--gray-200); }
th { font-weight: 600; color: var(--gray-500); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; background: var(--gray-50); }
tr:hover td { background: var(--gray-50); }
tr.clickable { cursor: pointer; }

/* Dashboard Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; text-align: center; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .8125rem; color: var(--gray-500); margin-top: .25rem; }
.stat-card.overdue .stat-value { color: var(--danger); }

/* Chat / Messages */
.chat-container { display: flex; flex-direction: column; gap: .75rem; max-height: 500px; overflow-y: auto; padding: 1rem; background: var(--gray-50); border-radius: var(--radius); margin-bottom: 1rem; }
.chat-msg { max-width: 80%; padding: .75rem 1rem; border-radius: 1rem; font-size: .875rem; line-height: 1.5; }
.chat-msg.from-whistleblower { background: var(--primary-light); color: var(--primary-dark); align-self: flex-start; border-bottom-left-radius: .25rem; }
.chat-msg.from-admin { background: white; border: 1px solid var(--gray-200); align-self: flex-end; border-bottom-right-radius: .25rem; }
.chat-msg .msg-time { font-size: .75rem; color: var(--gray-500); margin-top: .25rem; }
.chat-input { display: flex; gap: .5rem; }
.chat-input textarea { flex: 1; min-height: 60px; }

/* Success Box */
.success-box { background: var(--success-light); border: 2px solid var(--success); border-radius: var(--radius); padding: 2rem; text-align: center; }
.success-box .case-number { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin: .5rem 0; }
.success-box .access-key { font-family: monospace; font-size: 1.125rem; background: white; padding: .5rem 1rem; border-radius: var(--radius); display: inline-block; margin: .5rem 0; letter-spacing: .05em; border: 1px solid var(--success); }

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: .875rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Error UI */
#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; padding: .75rem; background: var(--danger-light); color: #991b1b; text-align: center; z-index: 1000; }

/* Responsive */
@media (max-width: 768px) {
    .app-main { padding: 1rem; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .app-header nav { gap: 0; }
    .app-header nav a { padding: .5rem .375rem; font-size: .75rem; }
}
