/* sendi — Admin-UI Styles. Self-hosted Fonts, Design-Tokens, kein Framework. */

@font-face {
    font-family: 'Inter';
    src: url('fonts/inter-latin.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('fonts/dm-sans-latin.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --color-primary: #0f766e;
    --color-primary-dark: #115e59;
    --color-primary-light: #ccfbf1;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-danger: #dc2626;
    --color-danger-light: #fee2e2;
    --color-success: #16a34a;
    --color-success-light: #dcfce7;
    --color-warning: #d97706;
    --color-warning-light: #fef3c7;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08);
    --shadow-lg: 0 8px 32px rgba(15, 23, 42, .14);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; font-weight: 700; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }

/* ---------- App-Layout ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 20px 18px 14px;
    border-bottom: 1px solid var(--color-border);
}

.brand-mark {
    font-family: 'DM Sans', var(--font);
    font-size: 22px;
    font-weight: 700;
    color: var(--color-primary);
    display: block;
}

.brand-tenant {
    font-size: 12px;
    color: var(--color-text-muted);
}

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-weight: 500;
}
.nav-item:hover { background: var(--color-bg); color: var(--color-text); text-decoration: none; }
.nav-item.active { background: var(--color-primary-light); color: var(--color-primary-dark); }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.user-name { font-weight: 600; }
.logout-link { color: var(--color-text-muted); }

.content { flex: 1; padding: 28px 32px; max-width: 1200px; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-header .actions { display: flex; gap: 8px; }

/* ---------- Komponenten ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--color-primary-dark); }
.stat-label { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--color-text-muted); margin-top: 6px; }

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.empty-hint { color: var(--color-text-muted); padding: 18px 0; text-align: center; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
}
.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--color-bg); }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--color-border);
    color: var(--color-text-muted);
}
.badge-active, .badge-sent { background: var(--color-success-light); color: var(--color-success); }
.badge-pending, .badge-scheduled, .badge-queueing, .badge-sending { background: var(--color-warning-light); color: var(--color-warning); }
.badge-unsubscribed, .badge-cancelled, .badge-failed, .badge-bounced { background: var(--color-danger-light); color: var(--color-danger); }
.badge-draft { background: var(--color-border); color: var(--color-text-muted); }

/* ---------- Buttons / Formulare ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-bg); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 5px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="datetime-local"], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-primary-light);
    border-color: var(--color-primary);
}
textarea { resize: vertical; min-height: 90px; }

.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
    font-size: 13px;
    margin: 10px 0;
    cursor: pointer;
}
.checkbox-label input { width: auto; margin-top: 2px; }

.help-text { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 13px;
}
.alert-error { background: var(--color-danger-light); color: var(--color-danger); }
.alert-success { background: var(--color-success-light); color: var(--color-success); }
.alert-info { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* ---------- Login ---------- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
}

.login-card {
    background: var(--color-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
}
.login-brand { margin-bottom: 18px; }
.login-card h1 { font-size: 18px; margin-bottom: 10px; }
.login-card .btn { margin-top: 20px; }

/* ---------- Modal ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow: auto;
    padding: 24px;
}
.modal h2 { margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- Toast ---------- */

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
}
.toast {
    background: var(--color-text);
    color: #fff;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    animation: toast-in .2s ease;
}
.toast-error { background: var(--color-danger); }
.toast-success { background: var(--color-success); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Oeffentliche Seiten (DOI, Abmelden, Anmeldeformular) ---------- */

.public-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
    padding: 20px;
}
.public-card {
    background: var(--color-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 44px 32px;
    text-align: center;
    max-width: 440px;
    width: 100%;
}
.public-card.text-left { text-align: left; }
.public-card .icon { font-size: 44px; margin-bottom: 12px; }
.public-card .icon-success { color: var(--color-success); }
.public-card .icon-error { color: var(--color-danger); }
.public-card h1 { font-size: 20px; margin-bottom: 8px; }
.public-card p { color: var(--color-text-muted); line-height: 1.6; }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .sidebar-nav { flex-direction: row; overflow-x: auto; }
    .nav-item span { display: none; }
    .content { padding: 18px 14px; }
    .form-row { flex-direction: column; gap: 0; }
}
