/* Vorhang Stoffmengen-Rechner CSS */
/* Schmid AG Innendekorationen */

/* ==================== */
/* ALLGEMEINE STYLES    */
/* ==================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #f5f5f5;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ==================== */
/* HEADER               */
/* ==================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #0033ff;
}

.logo {
    max-width: 250px;
    height: auto;
}

.header-text {
    text-align: right;
}

h1 {
    color: #333;
    margin-bottom: 5px;
    font-size: 28px;
}

.subtitle {
    color: #666;
    margin-bottom: 0;
    font-size: 14px;
}

/* ==================== */
/* KUNDENDATEN          */
/* ==================== */

.customer-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #0033ff;
}

.customer-section h2 {
    color: #0033ff;
    font-size: 20px;
    margin-bottom: 15px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0033ff;
    box-shadow: 0 0 0 2px rgba(0, 51, 255, 0.1);
}

/* ==================== */
/* SECTIONS             */
/* ==================== */

.section {
    margin-bottom: 40px;
}

.section-title {
    background: #0033ff;
    color: white;
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
}

.section-title.tuell {
    background: #0033ff;
}

.section-title.deko {
    background: #0055cc;
}

/* ==================== */
/* TABELLEN (DESKTOP)   */
/* ==================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

thead {
    background: #f0f4ff;
}

th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #0033ff;
    border-bottom: 2px solid #0033ff;
}

td {
    padding: 10px 8px;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: top;
}

/* ==================== */
/* FORM ELEMENTS        */
/* ==================== */

input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: white;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #0033ff;
    box-shadow: 0 0 0 2px rgba(0, 51, 255, 0.1);
}

select {
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

/* ==================== */
/* NOTIZFELDER          */
/* ==================== */

.notes-field {
    margin-top: 8px;
    display: none;
}

.notes-field.visible {
    display: block;
}

.notes-field textarea {
    font-size: 13px;
    padding: 6px;
}

/* ==================== */
/* ERGEBNIS             */
/* ==================== */

.result {
    background: #f0f4ff;
    padding: 8px;
    border-radius: 4px;
    font-weight: 600;
    color: #0033ff;
    text-align: center;
}

/* ==================== */
/* INFO BOX             */
/* ==================== */

.info-box {
    background: #fff9e6;
    border-left: 4px solid #ffcc00;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.info-box h3 {
    color: #856404;
    margin-bottom: 10px;
    font-size: 16px;
}

.info-box ul {
    margin-left: 20px;
    color: #856404;
}

.info-box li {
    margin: 5px 0;
}

/* ==================== */
/* BEMERKUNGEN          */
/* ==================== */

.remarks-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
    border-left: 4px solid #0033ff;
}

.remarks-section h3 {
    color: #0033ff;
    font-size: 18px;
    margin-bottom: 10px;
}

.remarks-section textarea {
    min-height: 100px;
}

/* ==================== */
/* BUTTONS              */
/* ==================== */

.btn-add-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #0033ff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-add-row:hover {
    background: #0029cc;
    transform: translateY(-1px);
}

.btn-add-row.deko-btn {
    background: #0055cc;
}

.btn-add-row.deko-btn:hover {
    background: #0044aa;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #c82333;
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button-row-output {
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-reset {
    background: #6c757d;
    color: white;
}

.btn-reset:hover {
    background: #5a6268;
}

.btn-print {
    background: #28a745;
    color: white;
}

.btn-print:hover {
    background: #218838;
}

.btn-summary {
    background: #0033ff;
    color: white;
}

.btn-summary:hover {
    background: #0029cc;
}

.btn-email {
    background: #17a2b8;
    color: white;
}

.btn-email:hover {
    background: #138496;
}

.btn-excel {
    background: #217346;
    color: white;
}

.btn-excel:hover {
    background: #195e37;
}

.btn-draft-save {
    color: #333 !important;
    font-weight: bold !important;
}

.btn-draft-save:hover {
    background-color: #ffb300 !important;
    box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
}

.btn-draft-load {
    color: white !important;
}

.btn-draft-load:hover {
    background-color: #5a2e9d !important;
}

.btn-draft-export {
    color: white !important;
}

.btn-draft-export:hover {
    background-color: #138496 !important;
}

.btn-draft-import {
    color: white !important;
}

.btn-draft-import:hover {
    background-color: #218838 !important;
}

.btn-draft-clear {
    color: white !important;
}

.btn-draft-clear:hover {
    background-color: #c82333 !important;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* E-Mail Status Meldungen */
.email-status {
    display: none;
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
    font-weight: 600;
    text-align: center;
}

.email-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.email-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ==================== */
/* FOOTER               */
/* ==================== */

.footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
    text-align: center;
    color: #666;
    font-size: 13px;
}

/* ==================== */
/* SUMMARY MODAL        */
/* ==================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #0033ff;
}

.modal-close {
    font-size: 28px;
    cursor: pointer;
    color: #666;
}

.summary-item {
    padding: 15px;
    background: #f0f4ff;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 4px solid #0033ff;
}

.summary-item.deko {
    background: #f5f8ff;
    border-left-color: #0055cc;
}

.summary-item h4 {
    color: #0033ff;
    margin-bottom: 5px;
}

.summary-item p {
    color: #666;
    font-size: 14px;
}

.summary-total {
    background: #0033ff;
    color: white;
    padding: 20px;
    border-radius: 5px;
    margin-top: 20px;
    text-align: center;
}

.summary-total h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.3);
}

.summary-stat {
    text-align: center;
}

.summary-stat-value {
    font-size: 20px;
    font-weight: bold;
}

.summary-stat-label {
    font-size: 13px;
    opacity: 0.9;
}

.delete-cell {
    width: 60px;
    text-align: center;
}

/* ========================================== */
/* RESPONSIVE - MOBILE (Karten-Layout)        */
/* ========================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo {
        max-width: 200px;
    }
    
    .header-text {
        text-align: center;
    }
    
    h1 {
        font-size: 22px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    /* Tabelle zu Karten umwandeln */
    table, thead, tbody, th, td, tr {
        display: block;
    }
    
    thead tr {
        display: none;
    }
    
    tbody tr {
        margin-bottom: 20px;
        border: 2px solid #0033ff;
        border-radius: 8px;
        padding: 15px;
        background: #f8f9fa;
        position: relative;
    }
    
    tbody tr.deko-row {
        border-color: #0055cc;
    }
    
    td {
        border: none;
        padding: 8px 0;
        position: relative;
    }
    
    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #0033ff;
        display: block;
        margin-bottom: 5px;
        font-size: 13px;
    }
    
    /* 2-Spalten-Layout für bestimmte Felder */
    .mobile-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    /* Delete Button oben rechts */
    .delete-cell {
        position: absolute;
        top: 10px;
        right: 10px;
        width: auto;
    }
    
    .delete-cell::before {
        display: none;
    }
    
    /* Faktor-Spalte verstecken auf Mobile */
    .factor-cell {
        display: none;
    }
    
    .buttons,
    .button-row {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
    
    .btn-add-row {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================== */
/* OFFLINE-FUNKTIONEN - DRAFT BUTTONS         */
/* ========================================== */

.btn-draft-save {
    color: #333 !important;
    font-weight: bold !important;
}

.btn-draft-save:hover {
    background-color: #ffb300 !important;
    box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
}

.btn-draft-load {
    color: white !important;
}

.btn-draft-load:hover {
    background-color: #5a2e9d !important;
}

.btn-draft-export {
    color: white !important;
}

.btn-draft-export:hover {
    background-color: #138496 !important;
}

.btn-draft-import {
    color: white !important;
}

.btn-draft-import:hover {
    background-color: #218838 !important;
}

.btn-draft-clear {
    color: white !important;
}

.btn-draft-clear:hover {
    background-color: #c82333 !important;
}

/* ========================================== */
/* PRINT - DIN A4 (nach Vorlage)              */
/* ========================================== */

@media print {
    @page {
        size: A4;
        margin: 20mm 15mm;
    }
    
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    body {
        background: white;
        padding: 0;
        font-size: 10pt;
        line-height: 1.4;
        color: #000;
    }
    
    .container {
        box-shadow: none;
        padding: 0;
        max-width: 100%;
        border-radius: 0;
    }
    
    /* Buttons und interaktive Elemente verstecken */
    .buttons, 
    .btn-add-row, 
    .btn-delete,
    .info-box {
        display: none !important;
    }
    
    /* Header - Logo verstecken, nur Titel */
    .header {
        border: none;
        padding: 0;
        margin-bottom: 20pt;
        display: block;
    }
    
    .logo {
        display: none;
    }
    
    .header-text {
        text-align: left;
    }
    
    .header-text h1 {
        font-size: 18pt;
        font-weight: bold;
        color: #000;
        margin: 0;
    }
    
    .header-text .subtitle {
        display: none;
    }
    
    /* Kundendaten - einfach untereinander */
    .customer-section {
        background: none;
        padding: 0;
        margin-bottom: 20pt;
        border: none;
        page-break-after: avoid;
    }
    
    .customer-section h2 {
        display: none;
    }
    
    .form-grid {
        display: block;
    }
    
    .form-group {
        margin-bottom: 2pt;
    }
    
    .form-group label {
        display: none;
    }
    
    .form-group input {
        border: none;
        padding: 0;
        font-size: 10pt;
        color: #000;
        background: none;
        width: 100%;
    }
    
    .form-group input::placeholder {
        color: transparent;
    }
    
    /* Section Titel */
    .section-title {
        background: none;
        color: #000;
        padding: 8pt 0 4pt 0;
        font-size: 12pt;
        font-weight: bold;
        border: none;
        border-radius: 0;
        margin-top: 15pt;
        margin-bottom: 8pt;
    }
    
    /* Tabellen - nach Vorlage */
    table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 5pt;
        font-size: 9pt;
        page-break-inside: auto;
    }
    
    thead {
        background: none;
    }
    
    th {
        border-bottom: 1pt solid #000;
        padding: 4pt 3pt;
        text-align: left;
        font-weight: bold;
        color: #000;
        font-size: 9pt;
    }
    
    td {
        border-bottom: 0.5pt solid #ccc;
        padding: 4pt 3pt;
        vertical-align: top;
        color: #000;
    }
    
    /* Eingabefelder in Tabelle - Werte anzeigen */
    td input,
    td select,
    td textarea {
        border: none;
        padding: 0;
        font-size: 9pt;
        color: #000;
        background: none;
        width: 100%;
        font-family: inherit;
    }
    
    td input::placeholder,
    td textarea::placeholder {
        color: transparent;
    }
    
    /* Notizfelder */
    .notes-field {
        display: block !important;
        margin-top: 2pt;
    }
    
    .notes-field textarea {
        font-size: 8pt;
        line-height: 1.2;
    }
    
    /* Faktor-Spalte sichtbar */
    .factor-cell {
        display: table-cell !important;
        text-align: center;
        font-size: 9pt;
    }
    
    /* Stoffmenge */
    .result {
        background: none;
        padding: 0;
        border: none;
        text-align: left;
        font-weight: bold;
        color: #000;
        font-size: 9pt;
    }
    
    /* Bemerkungen */
    .remarks-section {
        background: none;
        padding: 0;
        margin-top: 15pt;
        border: none;
        page-break-before: avoid;
    }
    
    .remarks-section h3 {
        color: #000;
        font-size: 12pt;
        font-weight: bold;
        margin-bottom: 6pt;
    }
    
    .remarks-section textarea {
        border: none;
        padding: 0;
        font-size: 10pt;
        color: #000;
        background: none;
        min-height: auto;
        font-family: inherit;
        line-height: 1.4;
    }
    
    .remarks-section textarea::placeholder {
        color: transparent;
    }
    
    /* Footer verstecken */
    .footer {
        display: none;
    }
    
    /* Seitenumbrüche optimieren */
    .section {
        page-break-inside: avoid;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    /* Mobile Klassen für Print ausschalten */
    table, thead, tbody, th, td, tr {
        display: table;
    }
    
    table {
        display: table;
    }
    
    thead {
        display: table-header-group;
    }
    
    tbody {
        display: table-row-group;
    }
    
    tr {
        display: table-row;
    }
    
    th, td {
        display: table-cell;
    }
}


.buttons{display:flex;flex-direction:column;gap:10px}
.button-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.button-row-single{grid-template-columns:1fr}
.button-row button{width:100%;min-height:50px}
.button-row-output{padding-top:10px;border-top:1px solid #e0e0e0}

.button-row > button{flex:1;min-width:0;}
.button-row-single > button{width:100%;flex:1;}
