:root {
    --primary: #003c5a;
    --accent: #00a5a5;
    --bg: #f5f7fa;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, sans-serif; background: var(--bg); }

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #003c5a, #00a5a5);
    padding: 20px;
}
.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 380px;
}
.logo { text-align: center; margin-bottom: 25px; }
.logo img { max-width: 180px; }
.logo h2 { color: var(--primary); margin-top: 10px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group input { width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 8px; font-size: 16px; }
.form-group input:focus { outline: none; border-color: var(--accent); }

/* Buttons */
.btn { padding: 12px 20px; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--accent); color: white; }
.btn-secondary { background: #002d44; color: white; }
.btn-accent { background: #ff9800; color: white; }
.btn-small { padding: 8px 14px; font-size: 14px; }
.btn-icon { background: transparent; color: white; font-size: 22px; padding: 5px 10px; }
.btn:disabled { opacity: 0.5; }
#login-form .btn { width: 100%; margin-top: 10px; }

.message { padding: 12px; border-radius: 8px; margin-bottom: 15px; }
.message.error { background: #fee; color: #c00; }
.hidden { display: none !important; }

/* App */
.app-container { min-height: 100vh; display: flex; flex-direction: column; }
.header {
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header h1 { font-size: 18px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
#user-display { font-size: 13px; opacity: 0.8; }

/* Search */
.search-bar { display: flex; gap: 8px; padding: 12px 15px; background: white; border-bottom: 1px solid #ddd; }
.search-bar input { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px; }

/* Breadcrumb */
.breadcrumb { padding: 10px 15px; background: white; border-bottom: 1px solid #eee; font-size: 14px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }

/* Files */
.main-content { flex: 1; overflow-y: auto; }
.file-list { padding: 8px; }
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    margin-bottom: 6px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}
.file-item:hover { border-color: var(--accent); }
.file-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 22px; }
.folder-icon { background: #fff3cd; }
.pdf-icon { background: #dc3545; color: white; font-size: 12px; font-weight: bold; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: #666; }

.loading { padding: 40px; text-align: center; color: #666; }
.spinner { width: 30px; height: 30px; border: 3px solid #ddd; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* PDF Viewer */
.pdf-container { position: fixed; inset: 0; background: #404040; display: flex; flex-direction: column; z-index: 100; }
.pdf-toolbar { background: var(--primary); padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.pdf-toolbar-group { display: flex; align-items: center; gap: 6px; }
.pdf-filename { color: white; font-size: 14px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#zoom-level { color: white; font-size: 13px; min-width: 45px; text-align: center; }

.pdf-viewer { flex: 1; overflow: auto; padding: 15px; display: flex; justify-content: center; }
#pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 15px; }
.pdf-page-container { position: relative; background: white; box-shadow: 0 2px 15px rgba(0,0,0,0.3); }
.pdf-page-container canvas { display: block; }

/* Form Fields - wichtig! */
.annotationLayer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}
.annotationLayer section {
    pointer-events: auto;
}
.pdf-field-text {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 2px 4px;
    font-family: inherit;
    color: transparent;
    caret-color: black;
}
.pdf-field-text:focus {
    background: white;
    color: black;
    outline: 2px solid var(--accent);
    z-index: 10;
}
.pdf-field-checkbox {
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 0;
}
.pdf-field-checkbox:checked + label,
section:has(.pdf-field-checkbox:checked) {
    background: rgba(0,165,165,0.3);
}

/* Signature */
.signature-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.signature-box { background: white; padding: 20px; border-radius: 12px; max-width: 550px; width: 90%; }
.signature-box h3 { margin-bottom: 12px; color: var(--primary); }
#signature-pad { width: 100%; border: 1px solid #ddd; border-radius: 6px; touch-action: none; }
.signature-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }

.signature-overlay { background: rgba(255,255,255,0.9); }
.signature-overlay img { width: 100%; height: 100%; object-fit: contain; }
.sig-delete {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

@media (max-width: 600px) {
    .pdf-toolbar { padding: 6px 8px; }
    .pdf-toolbar-group { gap: 4px; }
    .btn-small { padding: 6px 10px; font-size: 13px; }
}
