/**
 * STYLE.CSS
 * Fokus: Sauberes Initial-Layout, Z-Index Steuerung und visuelle Marker
 */

:root {
    --primary: #e30613;
    --bg: #ffffff;
    --border: #cccccc;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    margin: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* HEADER & NAVIGATION */
header {
    background: #ffffff;
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 100;
}

.brand { display: flex; align-items: center; gap: 15px; }
.logo-box { width: 25px; height: 25px; background: var(--primary); }
h1 { margin: 0; font-size: 1.1rem; color: #333; }
.thin { font-weight: 300; color: #999; }
#status-msg { font-size: 0.85rem; font-weight: 600; color: #333; background: #f1f1f1; padding: 5px 12px; border-radius: 15px; }

/* TAB SYSTEM */
.tab-container { background: #ffffff; border-bottom: 1px solid var(--border); z-index: 100; }
.tab-buttons { display: flex; background: #ffffff; }
.tab-btn {
    border: none; padding: 12px 25px; cursor: pointer;
    background: #ffffff; font-weight: 600; color: #666;
    transition: all 0.2s; border-right: 1px solid #eee;
}
.tab-btn:hover { background: #f9f9f9; }
.tab-btn.active { color: var(--primary); border-top: 3px solid var(--primary); margin-top: -3px; }

.tab-content { display: none; padding: 12px 30px; background: #ffffff; align-items: center; gap: 20px; flex-wrap: wrap; }
.tab-content.active { display: flex; }

/* MAIN VIEWPORT */
#main-container { flex: 1; display: flex; padding: 15px; gap: 15px; overflow: hidden; background: #f0f0f0; }

.pdf-container {
    flex: 1;
    background: #d0d0d0;
    position: relative;
    overflow: auto; 
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

/* DRAG & DROP VISUELLES FEEDBACK */
.pdf-container.drag-over {
    background: #e8f4ff;
    border: 3px dashed var(--primary);
    box-shadow: inset 0 0 20px rgba(227, 6, 19, 0.1);
}

.pdf-container.drag-over::before {
    content: "PDF hier ablegen";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    pointer-events: none;
    z-index: 1000;
    background: white;
    padding: 20px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* LAYOUT MODI */
.view-split .pdf-container {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

.view-overlay #container-left {
    display: block !important;
    flex: 1;
}

.view-overlay #container-right {
    display: none !important;
}

/* CANVAS WRAPPER (Fix für weisses Feld am Anfang) */
.canvas-wrapper { 
    position: relative; 
    background: white; 
    margin: 10px; 
    box-shadow: 0 4px 30px rgba(0,0,0,0.2); 
    display: inline-block;
    flex-shrink: 0;
    
    /* Initial unsichtbar, bis PDF geladen ist */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.canvas-wrapper.is-loaded {
    visibility: visible;
    opacity: 1;
}

/* LAYERING (Z-INDEX) */
canvas { image-rendering: crisp-edges; display: block; }
#canvas-bottom { position: relative; z-index: 10; }
#canvas-top { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 20; }
.drawing-layer { position: absolute; top: 0; left: 0; z-index: 45; pointer-events: none; }

/* MARKER (PASS-PUNKTE) */
.marker { 
    display: none; 
    position: absolute; 
    width: 16px; 
    height: 16px; 
    border-radius: 50%; 
    border: 2px solid white; 
    box-shadow: 0 0 8px rgba(0,0,0,0.5); 
    z-index: 2000; 
    pointer-events: none; 
    transform: translate(-50%, -50%); /* Exakte Zentrierung auf den Klickpunkt */
}

body.show-markers .marker { display: block !important; }

/* BUTTONS & TOOLS */
.btn-primary { background: var(--primary) !important; color: white !important; padding: 8px 18px; border: none; cursor: pointer; font-weight: 600; border-radius: 4px; }
.btn-secondary { background: #ffffff; color: #333; padding: 8px 18px; border: 1px solid #ddd; cursor: pointer; font-weight: 600; border-radius: 4px; }
.btn-export { background: #333 !important; color: white !important; padding: 8px 18px; border: none; cursor: pointer; font-weight: 600; border-radius: 4px; }

.file-input { background: #ffffff; padding: 6px 12px; border: 1px solid #ddd; cursor: pointer; font-size: 0.85rem; border-radius: 4px; }
.file-input input { display: none; }

select, input[type="color"] { padding: 6px; border: 1px solid #ddd; border-radius: 4px; background: white; }

.label-tag {
    position: absolute; top: 10px; left: 10px;
    background: rgba(227, 6, 19, 0.8); color: white;
    padding: 4px 10px; font-size: 0.7rem; z-index: 100;
    border-radius: 3px; pointer-events: none; text-transform: uppercase;
}

/* SCROLLBAR STYLING */
.pdf-container::-webkit-scrollbar { width: 10px; height: 10px; }
.pdf-container::-webkit-scrollbar-track { background: #f1f1f1; }
.pdf-container::-webkit-scrollbar-thumb { background: #888; border-radius: 5px; }
.pdf-container::-webkit-scrollbar-thumb:hover { background: #555; }