/* --- 1. BASIS & FARBEN --- */
:root { 
    --belfor-red: #e2001a; --success: #28a745; --step: #0056b3; 
    --accent: #ffc107; --danger: #dc3545; 
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body { 
    font-family: 'Segoe UI', Roboto, sans-serif; 
    background: #f4f4f4; margin: 0; padding: 5px; overflow: hidden; 
}

.container { 
    max-width: 600px; margin: 0 auto; background: white; 
    padding: 15px; border-radius: 20px; box-shadow: 0 4px 25px rgba(0,0,0,0.1);
    display: flex; flex-direction: column;
    height: 100dvh; margin-top: env(safe-area-inset-top); margin-bottom: env(safe-area-inset-bottom);
}

/* --- 2. SCANNER & STATUS --- */
#status-display { padding: 10px; border-radius: 10px; margin-bottom: 10px; text-align: center; border: 2px solid #ddd; font-weight: bold; font-size: 18px; }
.status-asset { border-color: var(--step); background: #eef6ff; color: var(--step); }
.status-code { border-color: orange; background: #fff8ee; color: #856404; }

#scanner-wrapper { 
    width: 100%; border-radius: 15px; overflow: hidden; 
    background: #000; margin-bottom: 10px; display: none; min-height: 250px; 
    position: relative;
}
#scanner-wrapper.visible { display: block; }

/* Stellt sicher, dass der Viewfinder (Ecken) sichtbar ist */
#reader { width: 100% !important; border: none !important; }
#reader__scan_region { z-index: 5; }
#reader video { width: 100% !important; height: auto !important; object-fit: cover; }

/* --- 3. ZOOM CONTROLS --- */
.zoom-controls { display: none; background: #1a1a1a; padding: 10px; border-radius: 12px; margin-bottom: 10px; flex-direction: column; gap: 8px; }
.zoom-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.btn-z { background: #333; border: 1px solid #444; color: white; padding: 10px 0; border-radius: 8px; font-weight: bold; font-size: 13px; cursor: pointer; }
.btn-z.active { background: var(--belfor-red); border-color: var(--belfor-red); }

/* --- 4. UTILITY BUTTONS (JETZT KLEINER) --- */
#util-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-util { 
    background: #f0f0f0; border: 1px solid #ddd; padding: 10px 5px; 
    border-radius: 12px; font-size: 11px; font-weight: bold; 
    flex: 1; cursor: pointer; display: flex; 
    flex-direction: row; align-items: center; justify-content: center; gap: 6px; 
}
.btn-util svg { width: 20px; height: 20px; color: #000; flex-shrink: 0; }

/* --- 5. LISTE (FULL WIDTH) --- */
.table-container { 
    margin-top: 10px; flex: 1; overflow-y: auto; 
    margin-left: -15px; margin-right: -15px; 
    border-top: 1px solid #eee; background: white;
}

.device-row {
    display: flex; align-items: center; padding: 12px 15px;
    border-bottom: 1px solid #eee; position: relative;
    overflow: hidden; width: 100%; min-height: 95px; background: white;
}
.row-acc { background: #fffdeb; } 

.thumb-container { width: 65px; height: 65px; flex-shrink: 0; }
.thumb-real, .thumb-placeholder { width: 65px; height: 65px; border-radius: 12px; border: 1px solid #ddd; object-fit: cover; }
.thumb-placeholder { background: #f8f8f8; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #bbb; }

.info-cell { flex: 1; padding-left: 15px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.info-cell b { font-size: 15px; color: #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-cell span { font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px; }

/* --- 6. ACTION OVERLAY (HALBE BREITE RECHTS) --- */
.actions-overlay {
    position: absolute; top: 0; bottom: 0; right: 0;
    width: 190px; /* Halbe Breite */
    background: inherit; /* Nimmt Weiß oder Gelb der Zeile an */
    display: flex; align-items: center; justify-content: space-evenly;
    z-index: 10; transform: translateX(101%);
    transition: transform 0.25s ease-out;
}
.device-row.show-actions .actions-overlay { transform: translateX(0); box-shadow: -10px 0 15px rgba(0,0,0,0.05); border-left: 1px solid #eee;}

.btn-icon { width: 45px; height: 45px; border-radius: 12px; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer;color:#fff; }

/* --- 7. SONSTIGES --- */
.btn-main { background: var(--belfor-red); color: white; border: none; padding: 14px; border-radius: 12px; width: 100%; font-weight: bold; font-size: 16px; cursor: pointer; margin-top: 5px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.overlay-container { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 3000; display: none; align-items: center; justify-content: center; padding: 20px; }
.overlay-box { background: white; padding: 25px; border-radius: 25px; width: 100%; max-width: 360px; text-align: center; }
.input-group { display: flex; align-items: center; border: 2px solid #ddd; border-radius: 12px; margin-bottom: 12px; background: white; overflow: hidden; }
.input-icon { padding: 12px; background: #fff; display: flex; align-items: center; border-right: 1px solid #eee; }
.overlay-input { width: 100%; padding: 12px; border: none; font-size: 16px; outline: none; }

.spinner { width: 45px; height: 45px; border: 5px solid #f3f3f3; border-top: 5px solid var(--belfor-red); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }


.overlay-container {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 5000;
    display: none; /* Initial versteckt */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.overlay-box {
    background: white;
    padding: 30px 25px;
    border-radius: 25px; /* Wie in deinem Edit-Design */
    width: 100%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* Button-Anpassung für Löschen */
.btn-main {
    transition: opacity 0.2s;
}
.btn-main:active {
    opacity: 0.8;
}
.edit-photo-header {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    margin: -20px -20px 20px -20px; /* Gleicht Padding des Overlays aus */
}

.header-photo-circle {
    width: 80%;
    height: auto;
    max-height: 150px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #fff;
}

.header-photo-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.photo-actions-low {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.btn-mini {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.note-text {
    display: block;
    font-size: 11px;
    color: #666;
    font-style: italic;
    margin-top: 4px;
    border-top: 1px solid #eee;
    padding-top: 2px;
    white-space: pre-wrap;
}
#overlay-note {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    resize: vertical; /* Erlaubt nur vertikales Skalieren */
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none; 
}
#overlay-note:focus {
    outline: none;
    border-color: var(--belfor-red, #e2001a); /* Nutzt deine Belfor-Farbe */
    box-shadow: 0 0 0 3px rgba(226, 0, 26, 0.1);
}
#overlay-note::placeholder {
    color: #aaa;
    font-style: italic;
}
.fab-scroll {
    position: fixed;
    bottom: 70px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--belfor-red, #e2001a);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.8;
}

.fab-scroll:active {
    transform: scale(0.9);
    opacity: 1;
}

/* Optional: Button verstecken, wenn man ganz unten ist */
.fab-scroll.hidden {
    display: none;
}
.fab-scroll {
    /* ... deine bisherigen Styles ... */
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    transform: scale(0);
    visibility: hidden;
    opacity: 0;
}

.fab-scroll.visible {
    transform: scale(1);
    visibility: visible;
    opacity: 1;
}

