/* 
 * cashbook - assets/css/app.css
 * Datei-Version: 0.9.0
 *
 * Modernes, cleanes Layout für das Online Kassabuch.
 */

/* Grund-Design-Variablen */
:root {
    --bg-body: #f3f4f6;
    --bg-elevated: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #111827;
    --bg-sidebar-active: #1e293b;

    --color-text: #111827;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;

    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #1d4ed8;

    --danger: #ef4444;
    --danger-light: #fecaca;

    --radius-card: 14px;
    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.18);
    --shadow-subtle: 0 8px 20px rgba(15, 23, 42, 0.12);

    --topbar-height: 56px;
    --sidebar-width: 230px;
    --transition-fast: 0.18s ease-out;
    --transition-med: 0.25s ease;
}

/* Reset / Basics */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #e0f2fe, #f3f4f6 40%, #e5e7eb 80%);
    color: var(--color-text);
    min-height: 100vh;
}

/* Links & Buttons */
a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* generische Buttons */
button,
.btn-primary,
.btn-link {
    font-family: inherit;
    cursor: pointer;
}

button {
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    padding: 0.45rem 1.15rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

/* primärer Link-Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:hover {
    text-decoration: none;
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

/* textlink in Topbar etc. */
.btn-link {
    background: transparent;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.4);
    margin-left: 0.5rem;
    box-shadow: none;
}

.btn-link:hover {
    background: rgba(148, 163, 184, 0.25);
    text-decoration: none;
}

/* Layout: Topbar, Sidebar, Content */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(14px);
    color: #e5e7eb;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.55);
}

.topbar-left,
.topbar-center,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-name {
    font-weight: 600;
    letter-spacing: 0.03em;
    font-size: 0.95rem;
    text-transform: uppercase;
}

.app-version {
    font-size: 0.75rem;
    color: #9ca3af;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.15);
}

/* Mandanten-Dropdown in der Mitte */
.tenant-switch label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #cbd5f5;
}

.tenant-switch select {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    padding: 0.28rem 0.8rem;
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    font-size: 0.85rem;
    outline: none;
}

/* Hauptlayout mit Sidebar */
main.page {
    display: flex;
    min-height: calc(100vh - var(--topbar-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: #e5e7eb;
    padding: 1.2rem 0.9rem 1.5rem;
    box-shadow: 4px 0 22px rgba(15, 23, 42, 0.55);
    position: relative;
    z-index: 10;
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-section {
    display: block;
    margin: 0.2rem 0 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 0.25rem 0.9rem;
}

.sidebar a {
    display: block;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 0.15rem;
    font-size: 0.88rem;
    color: #e5e7eb;
    transition: background var(--transition-fast), transform var(--transition-fast), padding-left var(--transition-fast);
}

.sidebar a:hover {
    background: var(--bg-sidebar-hover);
    transform: translateX(2px);
    text-decoration: none;
}

.sidebar li:first-child a {
    margin-bottom: 0.45rem;
}

/* Content-Bereich */
section.content {
    flex: 1;
    padding: 1.6rem 2.1rem 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Card-Style für Content */
section.content > h1 {
    margin-top: 0.2rem;
    margin-bottom: 0.9rem;
    font-size: 1.4rem;
    letter-spacing: 0.01em;
}

section.content > p {
    margin-top: 0;
    margin-bottom: 0.8rem;
    color: var(--color-muted);
    font-size: 0.92rem;
}

/* Formulare & Inputs */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.3rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-subtle);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.form-inline label {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    color: var(--color-muted);
    min-width: 150px;
}

.form-inline input[type="text"],
.form-inline input[type="number"],
.form-inline input[type="date"],
.form-inline select {
    margin-top: 0.25rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    padding: 0.4rem 0.55rem;
    font-size: 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: #ffffff;
    color: var(--color-text);
    outline: none;
    min-width: 0;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

/* Tabellen */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.8rem;
    background: rgba(255, 255, 255, 0.96);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    font-size: 0.86rem;
}

.data-table thead {
    background: linear-gradient(90deg, #1d4ed8, #3b82f6);
    color: #e5e7eb;
}

.data-table thead th {
    padding: 0.6rem 0.7rem;
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    white-space: nowrap;
}

.data-table tbody tr:nth-child(odd) {
    background: #f9fafb;
}

.data-table tbody tr:nth-child(even) {
    background: #ffffff;
}

.data-table tbody tr:hover {
    background: #eff6ff;
}

.data-table td {
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.data-table tfoot {
    background: #f3f4f6;
    font-weight: 600;
}

.data-table tfoot th,
.data-table tfoot td {
    padding: 0.5rem 0.7rem;
}

/* Alerts */
.alert {
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    margin-bottom: 0.9rem;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

/* Kleine Hilfsklassen */
hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.3rem 0;
}

/* Login-Seite – falls benutzt */

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: radial-gradient(circle at top, #1d4ed8, #030712);
    color: #e5e7eb;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-panel,
.login-card {
    background: rgba(15, 23, 42, 0.92);
    border-radius: 18px;
    padding: 1.6rem 1.9rem;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.login-panel h1,
.login-card h1 {
    margin-top: 0;
    margin-bottom: 0.4rem;
    font-size: 1.25rem;
}

.login-panel p,
.login-card p {
    margin-top: 0;
    margin-bottom: 1.1rem;
    font-size: 0.86rem;
    color: #9ca3af;
}

.login-panel form label,
.login-card form label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.login-panel input[type="text"],
.login-panel input[type="password"],
.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    margin-top: 0.25rem;
    margin-bottom: 0.8rem;
}

/* Buttons im Login */
.login-panel button,
.login-card button {
    width: 100%;
}

/* Responsive */
@media (max-width: 960px) {
    main.page {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.6);
    }

    .sidebar ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.2rem;
    }

    .sidebar li {
        flex: 1 1 auto;
    }

    .sidebar a {
        border-radius: 999px;
        text-align: center;
    }

    section.content {
        padding: 1.2rem 1.3rem 2rem;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 0 1rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        text-align: center;
    }

    .topbar-left,
    .topbar-center,
    .topbar-right {
        justify-content: center;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline label {
        width: 100%;
    }
}