/* =========================================
   RESET & VARIABLES
   ========================================= */
:root {
    --primary: #2563eb;       /* Modern Blue */
    --primary-dark: #1d4ed8;
    --secondary: #64748b;     /* Slate Gray */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --bg-body: #f3f4f6;       /* Light gray background for content */
    --bg-white: #ffffff;
    --bg-sidebar: #ffffff;
    
    --text-main: #1e293b;     /* Dark slate for text */
    --text-muted: #64748b;
    
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    
    --sidebar-width: 250px; /* Etwas schmaler gemacht (vorher 260px) */
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* =========================================
   SIDEBAR (COMPACT & SCROLLABLE)
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    padding: 1rem; /* Reduziert von 1.5rem -> Dichter */
    z-index: 100;
    overflow: hidden;
}

/* Logo Area */
.brand {
    font-size: 1.15rem; /* Etwas kleiner */
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem; /* Stark reduziert von 2.5rem -> Dichter */
    text-decoration: none;
    flex-shrink: 0;
}

/* Navigation Links (Scrollable Middle) */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem; /* Abstand zwischen Links verringert */
    flex: 1; 
    overflow-y: auto;
    padding-right: 2px;
    
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

.nav-menu::-webkit-scrollbar { width: 3px; }
.nav-menu::-webkit-scrollbar-track { background: transparent; }
.nav-menu::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 20px; }

.nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 800;
    margin-top: 1rem; /* Reduziert */
    margin-bottom: 0.25rem; /* Reduziert */
    letter-spacing: 0.05em;
    padding-left: 0.5rem; /* Bündig mit Text der Links */
}

/* Compact Link Styles */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem; /* Schlankere Buttons -> Dichter */
    border-radius: 6px;
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem; /* Etwas kleinere Schrift */
    transition: all 0.2s;
    flex-shrink: 0;
}

.nav-link:hover, .nav-link.active {
    background-color: #eff6ff;
    color: var(--primary);
}

.nav-link i { width: 20px; text-align: center; font-size: 0.9rem; }

/* Sidebar Footer */
.sidebar-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 0.75rem;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    z-index: 10;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.avatar {
    width: 32px; /* Kleinerer Avatar */
    height: 32px;
    background: #e0e7ff;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info div { font-size: 0.85rem; font-weight: 600; line-height: 1.2; }
.user-info span { font-size: 0.7rem; color: var(--text-muted); display: block; }

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem; /* Kompakterer Logout Button */
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-logout:hover { background: #fef2f2; border-color: #fee2e2; }

/* =========================================
   MAIN CONTENT AREA
   ========================================= */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 2rem 3rem;
}

.page-header { margin-bottom: 2rem; }
.page-header h2 { font-size: 1.8rem; font-weight: 700; color: var(--text-main); }
.page-header p { color: var(--text-muted); margin-top: 0.25rem; }

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-header h3 { font-size: 1.2rem; font-weight: 600; }

/* =========================================
   FORMS & BUTTONS
   ========================================= */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.5rem; }

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-group input, .form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    width: 100%;
    background: #fff;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: white; border: 1px solid var(--border); color: var(--danger); }
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); }
.btn-preview { background: var(--text-main); color: white; }
.btn-preview:hover { background: black; }

.form-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* =========================================
   LISTS & PREVIEW
   ========================================= */
.signature-list { display: flex; flex-direction: column; gap: 1rem; }

.signature-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: box-shadow 0.2s;
}

.signature-item:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.sig-details h4 { font-size: 1rem; margin-bottom: 0.25rem; }
.sig-details p { font-size: 0.85rem; color: var(--text-muted); }

.preview-box {
    background: #fafafa;
    border: 2px dashed var(--border);
    padding: 2rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.count-badge {
    background-color: #eff6ff; 
    color: #2563eb;            
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;    
    font-weight: 700;
    margin-left: 10px;
    border: 1px solid #dbeafe;
    vertical-align: middle;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    .sidebar { width: 70px; padding: 1rem 0.5rem; align-items: center; }
    .brand span, .nav-label, .nav-link span, .user-info, .btn-logout span { display: none; }
    .brand { margin-bottom: 1rem; justify-content: center; }
    .nav-link { justify-content: center; width: 100%; padding: 0.75rem; }
    .main-content { margin-left: 70px; width: calc(100% - 70px); padding: 1.5rem; }
    .nav-menu { overflow-y: auto; padding-right: 0; }
    .sidebar-footer { width: 100%; display: flex; flex-direction: column; align-items: center; flex-shrink: 0;}
    .btn-logout { padding: 0.5rem; border: none; }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { 
        width: 100%; 
        height: auto; 
        position: relative; 
        flex-direction: row; 
        justify-content: space-between;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow: visible;
    }
    .nav-menu { display: none; }
    .main-content { margin-left: 0; width: 100%; padding: 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .brand span { display: block; font-size: 1rem; }
}
