/* ============================================================
   DMS Archiv – Stylesheet  (ruhige, gedämpfte Palette)
   ============================================================ */

:root {
    /* Sidebar */
    --sb-bg:          #1b1f2e;
    --sb-border:      rgba(255,255,255,0.07);
    --sb-text:        #7c8499;
    --sb-text-hover:  #c0c7d4;
    --sb-active-bg:   rgba(255,255,255,0.10);
    --sb-active-text: #e2e6f0;

    /* Akzent – gedämpftes Slate-Blau */
    --primary:        #4f6589;
    --primary-dark:   #3d5070;
    --primary-light:  #eef1f6;

    /* Hauptbereich */
    --bg:             #f3f5f8;
    --surface:        #ffffff;
    --border:         #e4e8ed;
    --text:           #111827;
    --text-muted:     #6b7280;
    --text-faint:     #9ca3af;
}

/* ---- Reset & Base ---- */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ================================================================
   LOGIN
   ================================================================ */

.login-body {
    background: linear-gradient(145deg, #1b2035 0%, #131723 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
}

.login-box {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 18px;
    padding: 44px 38px 36px;
    width: 340px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

.login-box h2 {
    color: #e8ecf2;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px;
}

.login-box p.login-subtitle {
    color: var(--sb-text);
    font-size: 13px;
    margin: 0 0 26px;
}

.login-error {
    color: #f87171;
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.18);
    border-radius: 8px;
    font-size: 13px;
    padding: 8px 12px;
    margin-bottom: 14px;
}

.login-box input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 9px;
    color: #e8ecf2;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.login-box input::placeholder { color: rgba(255,255,255,0.25); }
.login-box input:focus {
    border-color: var(--primary);
    background: rgba(79,101,137,0.12);
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.2s;
}

.login-box button:hover { background: var(--primary-dark); }

/* ================================================================
   APP SHELL
   ================================================================ */

.app-shell {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ================================================================
   SIDEBAR
   ================================================================ */

.sidebar {
    width: 248px;
    background: var(--sb-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--sb-border);
}

.sidebar-brand {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 700;
    color: #c8d0dc;
    text-decoration: none;
    letter-spacing: -0.2px;
}

.sidebar-logo .logo-badge {
    background: rgba(79,101,137,0.5);
    color: #c0cfe4;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-stats {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--sb-border);
}

.sidebar-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #dde2eb;
    letter-spacing: -0.5px;
    line-height: 1;
}

.sidebar-stat-label {
    font-size: 11px;
    color: var(--sb-text);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.07) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }

/* Section labels */
.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.2);
    padding: 14px 8px 6px;
    display: block;
}

/* Home link */
.nav-home {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    color: var(--sb-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}

.nav-home:hover  { background: rgba(255,255,255,0.05); color: var(--sb-text-hover); }
.nav-home.active { background: var(--sb-active-bg); color: var(--sb-active-text); }

/* Year pills */
.year-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 2px 2px 6px;
}

.year-pill {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sb-text);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.year-pill:hover {
    background: rgba(255,255,255,0.09);
    color: var(--sb-text-hover);
    border-color: rgba(255,255,255,0.13);
}

.year-pill.active {
    background: rgba(255,255,255,0.15);
    color: #e0e6f0;
    border-color: rgba(255,255,255,0.22);
}

/* Category list */
.nav-cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-cat-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 7px;
    color: var(--sb-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-cat-item a:hover  { background: rgba(255,255,255,0.05); color: var(--sb-text-hover); }
.nav-cat-item a.active { background: var(--sb-active-bg); color: var(--sb-active-text); }

.nav-cat-icon {
    font-size: 13px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-cat-label { flex: 1; }

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 4px;
}

.sidebar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: #c8d0dc;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--sb-text-hover);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 10px;
    color: var(--sb-text);
}

.sidebar-logout {
    color: var(--sb-text);
    font-size: 15px;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.sidebar-logout:hover { background: rgba(255,255,255,0.05); color: #f87171; }

/* ================================================================
   TOPBAR
   ================================================================ */

.topbar {
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
    flex-shrink: 0;
}

.topbar-search {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
    flex: 1;
    max-width: 480px;
    transition: border-color 0.2s;
}

.topbar-search:focus-within {
    border-color: #8da3be;
}

.topbar-search input {
    border: none;
    background: transparent;
    padding: 8px 13px;
    flex: 1;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
}

.topbar-search input::placeholder { color: var(--text-faint); }

.topbar-search .search-spinner {
    padding: 0 10px;
    font-size: 12px;
    color: var(--text-faint);
    display: none;
}

.topbar-spacer { flex: 1; }

.topbar-badge {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 4px 11px;
    border-radius: 20px;
    border: 1px solid var(--border);
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================================================
   MAIN
   ================================================================ */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 40px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Page title + filter chips */
.page-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.view-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.filter-chips { display: flex; gap: 5px; flex-wrap: wrap; }

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px 3px 11px;
    text-decoration: none;
    border: 1px solid rgba(79,101,137,0.15);
    transition: background 0.15s;
}

.filter-chip:hover { background: #dde4ee; }
.filter-chip-x { font-size: 13px; opacity: 0.5; }

/* Section label */
.list-section-title {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 12px;
}

/* ================================================================
   YEAR GROUP (Kategorie-Filter)
   ================================================================ */

.year-group { margin-bottom: 28px; }

.year-group-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-group-count {
    font-size: 11px;
    font-weight: 600;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-faint);
    padding: 1px 7px;
    border-radius: 20px;
}

/* ================================================================
   DOCUMENT CARDS
   ================================================================ */

.doc-list { display: flex; flex-direction: column; gap: 5px; }

.card {
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: box-shadow 0.18s, border-color 0.18s;
}

.card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.07);
    border-color: #c8d2de;
}

.card-empty {
    padding: 50px 40px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
    border-style: dashed;
}

.doc-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.doc-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.doc-info { flex: 1; min-width: 0; }

.doc-summary { cursor: pointer; outline: none; list-style: none; }
.doc-summary::-webkit-details-marker { display: none; }

.doc-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.doc-path {
    font-size: 11px;
    color: var(--text-faint);
}

.doc-date {
    font-size: 11px;
    color: var(--text-faint);
}

.doc-date::before { content: '·'; margin-right: 6px; }

.doc-tags-pills {
    display: flex;
    gap: 5px;
    margin-left: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    overflow: hidden;
}

.tag-text {
    padding: 2px 6px;
}

.tag-remove {
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    color: var(--text-faint);
    padding: 2px 5px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.tag-remove:hover {
    background: rgba(248,113,113,0.1);
    color: #f87171;
}

.tag-add-input {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border: 1px dashed var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    width: 65px;
    outline: none;
    transition: width 0.2s, border-color 0.2s;
    text-transform: uppercase;
}

.tag-add-input:focus {
    width: 100px;
    border-color: var(--primary);
    border-style: solid;
}

/* ================================================================
   SEARCH STATE INDICATOR
   ================================================================ */

.search-info {
    font-size: 12px;
    color: var(--text-faint);
    margin-bottom: 10px;
    min-height: 18px;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 768px) {
    .sidebar     { display: none; }
    .topbar      { padding: 0 14px; }
    .topbar-badge { display: none; }
    .main-scroll   { padding: 18px 14px 28px; }
}

/* ================================================================
   SETTINGS
   ================================================================ */
.settings-tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

.settings-tag-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
}

.btn-danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
