/* ============================================================
   GIMA Finanzcontrolling – Stylesheet
   ============================================================ */

:root {
    --brand-color: #e64416;
    --brand-hover: #c73a12;
    --bg:       #f8fafc;
    --surface:  #ffffff;
    --border:   #e2e8f0;
    --text:     #1e293b;
    --text-muted: #475569;
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-400: #94a3b8;
    --gray-600: #475569;
    --gray-800: #1e293b;
    --success:  #16a34a;
    --danger:   #dc2626;
    --radius:   6px;
    --shadow:   0 1px 4px rgba(0,0,0,.08);
}

[data-theme="dark"] {
    --bg:       #0f172a;
    --surface:  #1e293b;
    --border:   #334155;
    --text:     #f1f5f9;
    --text-muted: #94a3b8;
    --gray-50:  #1e293b;
    --gray-100: #273548;
    --gray-200: #334155;
    --gray-400: #64748b;
    --gray-600: #94a3b8;
    --gray-800: #f1f5f9;
    --shadow:   0 1px 4px rgba(0,0,0,.3);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Noto Sans', system-ui, sans-serif; font-size: 0.95rem; color: var(--text); background: var(--bg); transition: background .2s, color .2s; }
a { color: var(--brand-color); }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Navbar ── */
.navbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1.5rem;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background .2s, border-color .2s;
}
.navbar-brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.brand-img { height: 32px; width: auto; }
.brand-text { font-family: 'Outfit', sans-serif; font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }
.navbar-nav { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; flex: 1; }
.navbar-nav a {
    display: block;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background .15s, color .15s;
}
.navbar-nav a:hover, .navbar-nav a.active {
    background: var(--gray-100);
    color: var(--brand-color);
}
.navbar-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: var(--text-muted); margin-left: auto; }
.navbar-username { font-size: 0.85rem; color: var(--text-muted); }
.btn-logout { color: var(--gray-400); text-decoration: none; font-size: 0.8rem; }
.btn-logout:hover { color: var(--brand-color); }

/* ── Dark-Mode Toggle ── */
.dark-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: border-color .15s, background .15s;
    line-height: 1;
}
.dark-toggle:hover { background: var(--gray-100); border-color: var(--brand-color); }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* ── Main content ── */
.main-content { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Headings ── */
h1, h2, h3 { font-family: 'Outfit', sans-serif; }

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.page-header h1 { margin: 0; font-size: 1.4rem; color: var(--text); }
.header-actions { display: flex; gap: 0.5rem; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background .15s, color .15s, border-color .15s;
}
.btn-primary   { background: var(--brand-color); color: white; border-color: var(--brand-color); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: white; }
.btn-secondary { background: white; color: var(--gray-600); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-100); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.form-card h2 { margin: 0 0 1.2rem; font-size: 1.05rem; color: var(--text); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.35rem; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--brand-color);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.inline-form { display: flex; gap: 0.75rem; align-items: center; }
.inline-form input { width: auto; flex: 1; padding: 0.45rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: var(--gray-100); padding: 0.6rem 1rem; text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.empty-cell { text-align: center; color: var(--gray-400); }

/* ── Badges ── */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 99px; font-size: 0.75rem; font-weight: 500; }
.badge-draft   { background: var(--gray-100); color: var(--gray-600); }
.badge-active  { background: #dcfce7; color: #15803d; }
.badge-closed  { background: #fee2e2; color: #b91c1c; }

/* ── KPI Dashboard ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
}
.kpi-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--brand-color); border-radius: var(--radius) var(--radius) 0 0; }
.kpi-value { font-size: 1.8rem; font-weight: 700; color: var(--gray-800); }
.kpi-label { font-size: 0.8rem; color: var(--gray-400); margin-top: 0.25rem; }
.kpi-link { display: inline-block; margin-top: 0.75rem; font-size: 0.8rem; color: var(--brand-color); text-decoration: none; }

/* ── Quick actions ── */
.quick-actions h2 { font-size: 1rem; margin-bottom: 1rem; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; }
.action-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--gray-600);
    font-size: 0.875rem;
    transition: border-color .15s, box-shadow .15s;
    box-shadow: var(--shadow);
}
.action-card:hover { border-color: var(--brand-color); color: var(--brand-color); }
.action-icon { font-size: 1.1rem; color: var(--brand-color); }

/* ── Cost grid ── */
.cost-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.cost-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.cost-card-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.cost-code { font-size: 0.75rem; font-weight: 700; background: var(--brand-color); color: white; padding: 0.15rem 0.5rem; border-radius: 4px; }
.cost-name { font-weight: 500; }
.cost-card-body { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--gray-600); }
.cost-total { font-weight: 700; color: var(--gray-800); }

/* ── Reports ── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-decoration: none; color: var(--gray-800); box-shadow: var(--shadow); transition: border-color .15s; }
.report-card:hover { border-color: var(--brand-color); }
.report-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.report-title { font-weight: 600; margin-bottom: 0.25rem; }
.report-desc { font-size: 0.8rem; color: var(--gray-400); }
.report-section { margin-bottom: 2rem; }
.report-section h2 { font-size: 1.05rem; margin-bottom: 0.75rem; }

/* ── Budget summary ── */
.budget-summary { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.summary-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.summary-label { display: block; font-size: 0.8rem; color: var(--gray-400); margin-bottom: 0.25rem; }
.summary-value { font-size: 1.4rem; font-weight: 700; }

/* ── Liquidity ── */
.liquidity-table-wrapper { overflow-x: auto; }
.liquidity-table th, .liquidity-table td { white-space: nowrap; min-width: 70px; }

/* ── States ── */
.positive { color: var(--success); }
.negative { color: var(--danger); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state p { margin-bottom: 1rem; }

/* ── Alert ── */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* ── Login ── */
.login-body { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; background: var(--bg); }
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-logo-img { height: 48px; width: auto; margin-bottom: 0.75rem; }
.login-header h1 { margin: 0; font-size: 1.1rem; color: var(--gray-600); font-weight: 400; }
.login-dark-toggle { position: fixed; top: 1rem; right: 1rem; z-index: 10; }

/* ── Footer ── */
.site-footer {
    text-align: center;
    padding: 1.2rem 1rem;
    margin-top: 3rem;
    color: var(--gray-400);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    transition: background .2s, border-color .2s;
}
.site-footer a {
    color: var(--gray-400);
    text-decoration: none;
}
.site-footer a:hover {
    color: var(--brand-color);
}

/* ── Dev-Mode Banner ── */
.dev-banner-box {
    background: #fff176;
    border-bottom: 2px solid #e64416;
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dev-banner-icon {
    animation: blink 1.2s step-start infinite;
}
@keyframes blink {
    50% { opacity: 0; }
}

/* ── Bug-Report Button ── */
#bugReportBtn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--brand-color);
    color: white;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .15s;
}
#bugReportBtn:hover {
    background: var(--brand-hover);
    transform: scale(1.08);
}

/* ── Bug-Report Modal ── */
#bugReportOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1300;
}
#bugReportModal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(480px, 92vw);
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    z-index: 1400;
}
