/* Mad Nice Group - Group Kalkulator Styles */

/* Font */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    /* Base colors */
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --background: #ffffff;
    --border-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 10px;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px 0;
    position: relative;
}

.logo-container {
    flex: 0 0 auto;
}

.logo {
    max-width: 200px;
    height: auto;
    display: block;
}

header h1 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    text-align: center;
}

main {
    background: var(--background);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

section {
    margin-bottom: 20px;
}

section h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.calculation-header-with-timestamp {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    justify-content: space-between;
}

.calculation-header-with-timestamp h2 {
    margin-bottom: 0;
    flex: 0 0 auto;
    border-bottom: none;
    padding-bottom: 0;
}

.calculation-header-buttons {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.calculation-header-buttons .volume-calculate-btn,
.calculation-header-buttons .volume-reset-btn {
    flex: none;
    padding: 8px 16px;
}

.export-timestamp {
    font-size: 1.2rem;
    font-weight: 400;
    flex: 0 0 auto;
    display: none; /* Hidden by default, shown only during export */
}

.export-logo {
    max-width: 150px;
    height: auto;
    flex: 0 0 auto;
    display: none; /* Hidden by default, shown only during export */
}

/* Calculation footer with project fields and export button */
.calculation-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-top: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.calculation-footer-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* In der Footer-Button-Leiste sollen die Buttons sich nicht auf volle Breite strecken */
.calculation-footer-buttons .volume-calculate-btn,
.calculation-footer-buttons .volume-reset-btn {
    flex: 0 0 auto;
}

.project-fields-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.project-name-input-wrapper,
.project-field-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.project-name-label,
.project-field-label {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    white-space: nowrap;
    flex: 0 0 150px; /* fixed label width so inputs align */
    max-width: 150px;
}

.project-field-label {
    font-weight: 600;
    font-size: 1rem;
}

.project-name-input,
.project-field-input,
.project-textarea {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Anzeigevariante der Zusatzinformationen im PDF (erhält Zeilenumbrüche) */
.project-textarea-display {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 8px 12px;
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    white-space: pre-wrap;
}

/* PDF-Export: Projektfelder im Block, Input über ganze Zeile */
.pdf-project-fullwidth .project-name-input-wrapper,
.pdf-project-fullwidth .project-field-wrapper {
    flex-direction: column;
    align-items: flex-start;
}

.pdf-project-fullwidth .project-name-label,
.pdf-project-fullwidth .project-field-label {
    flex: 0 0 auto;
    max-width: none;
}

.pdf-project-fullwidth .project-name-input,
.pdf-project-fullwidth .project-field-input,
.pdf-project-fullwidth .project-textarea {
    width: 100%;
}

.export-pdf-btn {
    padding: 10px 22px;
    background: #ED6A4C;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 0 0 auto;
    min-height: 42px;
    line-height: 1.2;
}

.export-pdf-btn:hover {
    background: #d85a3f;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(237, 106, 76, 0.3);
}

.export-pdf-btn:active {
    transform: translateY(0);
}

.project-name-input:focus,
.project-field-input:focus,
.project-textarea:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--background);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.project-name-input::placeholder,
.project-field-input::placeholder,
.project-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

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

.form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.form-group {
    margin-bottom: 0;
    height: 60px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: var(--font-family);
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--background);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 50px;
}

.form-group input[readonly] {
    background: var(--background);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Disabled/locked fields styling */
.form-group input[disabled],
.form-group input.locked-field {
    background: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.5;
    color: #999;
    border-color: #d0d0d0;
}

.form-group input[disabled]:focus,
.form-group input.locked-field:focus {
    outline: none;
    border-color: #d0d0d0;
    background: #f0f0f0;
    box-shadow: none;
}

/* Role select styling with entity colors */
.role-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.role-select {
    font-weight: 500;
    flex: 1;
}

.role-select.entity-mngr {
    color: #000000;
}

.role-select.entity-mnag {
    color: #ED6A4C;
}

.role-select.entity-mnwb {
    color: #55BEC5;
}

.role-select.entity-mnat {
    color: #00663A;
}

.role-select.entity-mnau {
    color: #4F79AC;
}

.role-select.entity-mnmh {
    color: #D41868;
}

.role-select.entity-ext {
    color: #FFD700;
}

.percent-input-wrapper {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

.role-percent-input {
    width: 60px;
    padding: 6px 8px;
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
}

.role-percent-input:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--background);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.percent-sign {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Entity colors as classes */
.entity-mngr {
    color: #000000;
}

.entity-mnag {
    color: #ED6A4C;
}

.entity-mnwb {
    color: #55BEC5;
}

.entity-mnat {
    color: #00663A;
}

.entity-mnau {
    color: #4F79AC;
}

.entity-mnmh {
    color: #D41868;
}

.entity-ext {
    color: #FFD700;
}

.entity-overhead {
    color: #5a5a5a;
}

/* Remove spinner on number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Volume distribution grid */
.volume-distribution-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.volume-entity-column {
    display: flex;
    flex-direction: column;
}

.volume-entity-header {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.volume-calculate-row {
    display: flex;
    align-items: flex-end;
}

.volume-calculate-label {
    flex: 0 0 auto;
}

.volume-spacer .volume-spacer-inner {
    min-height: 36px;
}

.volume-calculate-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
}

.volume-calculate-btn,
.volume-reset-btn {
    flex: 1;
    padding: 10px 22px;
    border: none;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    min-height: 42px;
    line-height: 1.2;
}

.volume-calculate-btn {
    background: #ED6A4C;
    color: white;
}

.volume-calculate-btn:hover {
    background: #d95a3c;
    box-shadow: 0 2px 6px rgba(237, 106, 76, 0.3);
}

.volume-calculate-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(237, 106, 76, 0.3);
}

.volume-reset-btn {
    background: #ED6A4C;
    color: white;
}

.volume-reset-btn:hover {
    background: #d95a3c;
    box-shadow: 0 2px 6px rgba(237, 106, 76, 0.3);
}

.volume-reset-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(237, 106, 76, 0.3);
}

/* Percentage table */
.percentage-table-container {
    overflow-x: auto;
}

.percentage-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.percentage-table thead th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
    background: #f9f9f9;
}

.percentage-table thead th:first-child {
    text-align: left;
    background: transparent;
    border-bottom: 2px solid var(--border-color);
}

.percentage-table tbody td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.percentage-table tbody td:first-child {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.percentage-table tbody td input {
    width: 100%;
    padding: 6px 8px;
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
}

.percentage-table tbody td input:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--background);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.percentage-table tbody td input[readonly] {
    background: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Calculation table */
.calculation-table-container {
    overflow-x: auto;
}

.calculation-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.calculation-table thead th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
    background: #f9f9f9;
}

.calculation-table thead th:first-child {
    text-align: left;
    background: #ED6A4C;
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
    color: #ffffff;
    font-size: 1.1rem;
    padding: 12px 16px;
}

.calculation-table tbody td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.calculation-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.calc-cell {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.calc-cell-percent {
    color: #999;
    font-weight: 400;
    margin-right: 0.25em;
}

.calc-cell.positive {
    color: #00663A;
}

.calc-cell.negative {
    color: #D41868;
}

.sum-row td {
    font-weight: 600;
    border-top: 2px solid var(--border-color);
    background: #f9f9f9;
}

.sum-cell {
    font-weight: 700;
}

/* Row background colors */
.calc-row-sales {
    background-color: #ffe8dc;
}

.calc-row-group {
    background-color: #d4f4e6;
}

.calc-row-fulfillment {
    background-color: #d4e8ff;
}

.calc-row-provision {
    background-color: #ffe8dc;
}

.calc-row-support {
    background-color: #d4f4e6;
}

.calc-row-external-costs {
    background-color: #d4e8ff;
}

.calc-row-external-costs-mngr {
    background-color: #d4e8ff;
}

/* External Costs Notes Section */
.external-costs-notes-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
    display: none; /* Hidden by default, shown when notes exist */
}

.external-costs-notes-section.has-notes {
    display: block;
}

.notes-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.note-item {
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
}

.note-item-header {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.note-item-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.note-item-content:empty::before {
    content: "(keine Notiz)";
    font-style: italic;
    color: #999;
}
 