:root { 
    --re-red: #c41230; 
    --re-dark: #121212; 
    --re-gray: #2b2b2b;
    --re-gold: #cfa144;
    --bg-light: #f4f4f6;
    --text-main: #333333;
}

body { 
    font-family: 'Open Sans', Arial, sans-serif; 
    margin: 0; 
    background: var(--bg-light); 
    color: var(--text-main);
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
}

h1, h2, h3, th { font-family: 'Montserrat', sans-serif; }

/* HEADER */
header { 
    background: var(--re-dark); 
    color: white; 
    padding: 10px 20px; 
    border-bottom: 4px solid var(--re-red); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.header-content { display: flex; justify-content: space-between; align-items: center; max-width: 1600px; margin: 0 auto; width: 100%; }
.header-content h1 { margin: 10px 0; font-weight: 800; font-size: 1.8rem; letter-spacing: 1px;}
.header-subtitle { font-weight: 400; color: #aaa; }

.nav-btn { background: none; color: #888; border: none; padding: 15px 20px; cursor: pointer; font-weight: 600; font-size: 1rem; transition: 0.3s; font-family: 'Montserrat', sans-serif;}
.nav-btn:hover { color: white; }
.nav-btn.active { color: var(--re-gold); border-bottom: 3px solid var(--re-gold); }

.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.print-btn { background: var(--re-red); color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: 600; text-transform: uppercase; transition: 0.2s;}
.print-btn:hover { background: #9c0e25; }
.settings-btn { background: #444; color: white; border: none; padding: 10px 15px; border-radius: 4px; cursor: pointer; transition: 0.2s;}
.settings-btn:hover { background: #666; }

/* LAYOUT */
.main-wrapper { display: grid; grid-template-columns: 1fr 450px; flex: 1; overflow: hidden; max-width: 1600px; margin: 0 auto; width: 100%; }
.page { padding: 30px; overflow-y: auto; background: white; box-shadow: inset 0 0 10px rgba(0,0,0,0.02); }

/* FILTER BAR */
.filter-bar { display: flex; gap: 15px; margin-bottom: 25px; background: #fff; padding: 20px; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.filter-group { display: flex; flex-direction: column; flex: 1; font-size: 0.85rem; font-weight: 600; color: #555;}
.filter-group input, .filter-group select { padding: 10px; border: 1px solid #ccc; border-radius: 4px; margin-top: 6px; font-family: inherit; font-size: 0.95rem; }
.filter-group input:focus, .filter-group select:focus { border-color: var(--re-red); outline: none; }

/* TABLE (Shop Style) */
.table-container { width: 100%; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { background: var(--re-dark); color: white; padding: 15px; text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
th:first-child { border-top-left-radius: 6px; }
th:last-child { border-top-right-radius: 6px; }
td { padding: 15px; border-bottom: 1px solid #eee; font-size: 0.95rem; vertical-align: middle; }
tr:hover td { background-color: #fcfcfc; }

/* BUTTONS IN TABLE */
.action-buttons { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;}
.add-btn { background: var(--re-red); color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 0.85rem; transition: 0.2s; text-transform: uppercase;}
.add-btn:hover { background: #9c0e25; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(196, 18, 48, 0.3);}
.pdf-btn { background: var(--re-gray); color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 0.85rem; transition: 0.2s; font-weight: 600;}
.pdf-btn:hover { background: var(--re-gold); color: var(--re-dark); transform: translateY(-1px); }

/* SIDEBAR / CART */
aside { background: #fff; border-left: 1px solid #ddd; padding: 30px; overflow-y: auto; display: flex; flex-direction: column; box-shadow: -4px 0 15px rgba(0,0,0,0.03);}
.cart-title { font-weight: 800; text-transform: uppercase; font-size: 1.2rem; margin-top: 0; color: var(--re-dark);}
#cart-vehicle-name { color: var(--re-red); font-weight: bold; margin-bottom: 20px; font-size: 1.1rem; border-bottom: 2px solid #eee; padding-bottom: 10px; }
.offer-table { width: 100%; border-collapse: collapse; }
.offer-table td { padding: 12px 0; border-bottom: 1px dashed #ddd; vertical-align: middle; }
.cart-thumb { width: 45px; height: 45px; object-fit: cover; border-radius: 4px; border: 1px solid #eee; }
.del-btn { color: #aaa; cursor: pointer; font-weight: bold; font-size: 1.4rem; margin-left: 12px; transition: color 0.2s; }
.del-btn:hover { color: var(--re-red); }
.cart-total { margin-top: auto; border-top: 3px solid var(--re-dark); padding-top: 20px; text-align: right; }
#total-price { font-size: 2rem; color: var(--re-red); font-weight: 800; font-family: 'Montserrat', sans-serif;}

/* SETTINGS MODAL */
.settings-panel { display: none; position: absolute; top: 75px; right: 20px; background: white; width: 340px; padding: 25px; border-radius: 8px; box-shadow: 0 15px 50px rgba(0,0,0,0.3); z-index: 2000; border: 2px solid var(--re-red); }
.settings-panel h3 { margin-top: 0; }
.settings-panel input { width: 100%; margin-bottom: 12px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }
.file-label { display: block; background: #f8f8f8; padding: 15px; text-align: center; border: 2px dashed #bbb; cursor: pointer; border-radius: 4px; margin-bottom: 10px; font-weight: 600; color: #555;}
.file-label:hover { border-color: var(--re-red); color: var(--re-red);}
.save-btn { background: #28a745; color: white; width: 100%; border: none; padding: 12px; cursor: pointer; font-weight: bold; border-radius: 4px; margin-bottom: 8px; text-transform: uppercase;}
.close-small { background: #eee; border: none; width: 100%; padding: 10px; cursor: pointer; border-radius: 4px; font-weight: 600;}
.status-text { font-size: 0.75rem; margin-bottom: 15px; text-align: center; color: #666;}

/* BILDER & PDF MODAL GEMEINSAM */
.thumbnail { width: 65px; height: 65px; object-fit: cover; border-radius: 6px; cursor: zoom-in; border: 1px solid #ddd; transition: 0.2s; }
.thumbnail:hover { border-color: var(--re-red); transform: scale(1.1); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

.modal { display: none; position: fixed; z-index: 5000; left: 0; top: 0; width: 100%; height: 100%; justify-content: center; align-items: center; }
.modal-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); backdrop-filter: blur(4px); }
.img-close-btn { position: absolute; top: -50px; right: 0; background: var(--re-red); color: white; border: none; padding: 10px 20px; cursor: pointer; border-radius: 4px; font-weight: bold; font-size: 1rem; text-transform: uppercase;}
.img-close-btn:hover { background: #9c0e25; }

/* BILDER LUPE */
.image-container-p { position: relative; max-width: 90%; max-height: 90%; z-index: 5001; }
#zoomed-image { max-width: 100%; max-height: 85vh; border: 4px solid #fff; border-radius: 8px; box-shadow: 0 15px 50px rgba(0,0,0,0.6); }

/* PDF OVERLAY */
.pdf-container { position: relative; width: 85%; height: 85vh; background: white; z-index: 5001; border-radius: 8px; box-shadow: 0 15px 50px rgba(0,0,0,0.6); display: flex; flex-direction: column; }
#pdf-iframe { width: 100%; height: 100%; border: none; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; border-top-left-radius: 8px; border-top-right-radius: 8px;}


/* --- RESPONSIVE DESIGN (Tablets & Smartphones) --- */
@media (max-width: 1024px) {
    .main-wrapper {
        grid-template-columns: 1fr; /* Stapelt Shop und Warenkorb untereinander */
        overflow-y: auto;
    }
    aside {
        border-left: none;
        border-top: 4px solid var(--re-red); /* Sichtbare Trennung zum Warenkorb */
        box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column; /* Suchleiste und Menü untereinander */
        text-align: center;
        gap: 15px;
    }
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    .filter-bar {
        flex-direction: column; /* Filtereingaben untereinander auf kleinen Bildschirmen */
    }
    .table-container {
        overflow-x: auto; /* Erlaubt das seitliche Wischen der Tabelle auf dem Handy! */
        border: 1px solid #eee;
        border-radius: 6px;
    }
    th, td {
        padding: 10px;
        font-size: 0.85rem;
    }
    .page { padding: 15px; }
    
    /* PDF Overlay auf dem Handy fast bildschirmfüllend */
    .pdf-container {
        width: 95%;
        height: 90vh;
    }
}

/* DRUCK-MODUS */
@media print {
    header, .hide-on-print, .filter-bar, main, .modal, .del-btn { display: none !important; }
    body { background: white; margin: 0; padding: 0; display: block; font-family: 'Open Sans', sans-serif;}
    .main-wrapper { display: block; width: 100%; margin: 0; }
    aside { border: none; padding: 0; width: 100%; overflow: visible; display: block; box-shadow: none;}
    #cart { width: 100%; }

    #master-print-header { display: block !important; width: 100%; margin-bottom: 15px; }
    .print-top-row { display: flex; justify-content: space-between; align-items: flex-start; }
    .print-logo-box { width: 250px; }
    .red-line { border: none; border-top: 4px solid var(--re-red); margin: 15px 0; }
    .print-offer-title { text-align: center; color: var(--re-red) !important; font-size: 20pt; margin: 10px 0 0 0; font-family: 'Montserrat', sans-serif; font-weight: 800;}
    .print-model-title { text-align: center; font-size: 16pt; margin: 5px 0 20px 0; color: #333; font-weight: 600; font-family: 'Montserrat', sans-serif;}
    
    .print-meta { text-align: right; margin-bottom: 20px; font-size: 11pt; color: #555; }

    .offer-table { width: 100%; border-top: 2px solid #333; }
    .offer-table td { padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 11pt; color: #222; font-weight: 400 !important;}
    .offer-table td strong { font-weight: 600; font-size: 12pt; }
    
    .cart-total { border-top: 2px solid #333; margin-top: 20px; color: #333; font-weight: normal; }
    #total-price { color: #222 !important; font-size: 16pt !important; font-weight: 600 !important; }
    .print-footer { display: block !important; position: fixed; bottom: 10px; width: 100%; text-align: center; font-size: 10pt; color: #666;}
}

/* --- ANTI-COPY MASSNAHMEN --- */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
img {
    -webkit-user-drag: none;
    pointer-events: none;
}
.thumbnail, .print-logo-box img { pointer-events: auto; }