:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f7fa;
    padding: 20px;
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

h1 {
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    margin-right: 10px;
}

/* Modal Styles for Bootstrap Compatibility */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color 0.15s linear;
}

.modal.show {
    display: block !important;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    pointer-events: none;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.3rem;
    outline: 0;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: #000;
}

.modal-backdrop.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal-backdrop.show {
    opacity: 0.5;
}

body.modal-open {
    overflow: hidden;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

button.danger {
    background-color: var(--danger-color);
}

button.danger:hover {
    background-color: #c0392b;
}

input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    width: 100%;
    transition: var(--transition);
}

input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--primary-color);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
}

.forecast-controls {
    margin: 20px 0 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.forecast-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 15px;
}

.forecast-field {
    flex: 1;
    min-width: 200px;
    margin-bottom: 15px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.tab-container {
    margin-bottom: 30px;
}

.year-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.year-tab {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin-right: 5px;
    transition: var(--transition);
}

.year-tab:hover {
    background-color: #e9ecef;
}

.year-tab.active {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    max-width: 100%;
}

table {
    border-collapse: collapse;
    width: 100%;
    background-color: #f9f9f9;
    font-size: 13px;
    table-layout: fixed;
    border: 1px solid #ccc;
}

thead {
    background-color: #3a5275;
    color: white;
    position: sticky;
    top: 0;
    z-index: 2;
}

th, td {
    border: 1px solid #d0d0d0;
    padding: 6px 8px;
    text-align: right;
    overflow: visible;
}

td input, td span {
    width: 100%;
    text-align: right;
    box-sizing: border-box;
}

td:first-child, th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 1;
    box-shadow: 3px 0 5px rgba(0,0,0,0.1);
    width: 140px;
    min-width: 140px;
    background-color: #eef2f7;
    font-weight: 500;
    font-size: 12px;
}

thead th:first-child {
    background-color: #2c3e50;
    z-index: 3;
    text-align: left;
    padding-left: 10px;
}

th:not(:first-child), td:not(:first-child) {
    width: 65px;
    min-width: 65px;
    max-width: 65px;
}

tr:nth-child(even) {
    background-color: #f2f6fa;
}

tr:nth-child(odd) {
    background-color: #ffffff;
}

tr:hover {
    background-color: #e8f0fe;
}

tr.section-header {
    background-color: #d4e6f1;
    font-weight: bold;
    color: #2c3e50;
    border-top: 2px solid #3498db;
}

.category-header {
    background-color: #eaf2f8;
    font-weight: bold;
    font-size: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding: 12px 10px;
}

.positive {
    color: #27ae60;
    font-weight: 600;
    background-color: rgba(39, 174, 96, 0.05);
}

.negative {
    color: #e74c3c;
    font-weight: 600;
    background-color: rgba(231, 76, 60, 0.05);
}

.year-settings {
    margin-bottom: 15px;
}

.add-year-btn {
    margin-left: 10px;
    background-color: var(--success-color);
}

.add-year-btn:hover {
    background-color: #27ae60;
}

.remove-year-btn {
    background-color: var(--danger-color);
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    margin-left: 10px;
}

.remove-year-btn:hover {
    background-color: #c0392b;
}

@media (max-width: 1366px) {
    th:not(:first-child), td:not(:first-child) {
        width: 60px;
        min-width: 60px;
    }
    
    th, td {
        padding: 5px 6px;
        font-size: 12px;
    }
}

/* Hochspezifische Selektoren für Monatsüberschriften */
.table-wrapper table thead tr th.month-header {
    color: white !important;
    font-weight: 600 !important;
    background-color: #3a5275 !important; /* Passend zum Header-Blau */
    text-align: center !important;
    font-size: 12px !important;
    border: 1px solid #4a6285 !important;
    vertical-align: middle !important;
}

/* Eindeutige Klasse für Monatsinhalte */
.month-header-wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px 0 !important;
}

/* Monatsnamen */
.month-name-custom {
    display: block !important;
    font-weight: 600 !important;
    margin-bottom: 3px !important;
    color: white !important;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2) !important;
}

/* Monatsnummern */
.month-number-custom {
    display: block !important;
    font-size: 10px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: normal !important;
}

/* Erste Spalte (sticky) */
table thead th:first-child,
table tbody td:first-child {
    text-align: left !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 1 !important;
    box-shadow: 3px 0 5px rgba(0,0,0,0.1) !important;
}

table thead th:first-child {
    background-color: #2c3e50 !important;
    z-index: 3 !important;
    color: white !important;
}

table tbody td:first-child {
    background-color: #eef2f7 !important;
}

/* Zeilen-Styles */
table tr.section-header {
    background-color: #d4e6f1 !important;
    font-weight: bold !important;
    color: #2c3e50 !important;
    border-top: 2px solid #3498db !important;
}

.category-header {
    background-color: #eaf2f8 !important;
    font-weight: bold !important;
    font-size: 15px !important;
    color: #2c3e50 !important;
    border-bottom: 2px solid #3498db !important;
}

/* Positive/Negative Werte */
.positive {
    color: #27ae60 !important;
    font-weight: 600 !important;
    background-color: rgba(39, 174, 96, 0.05) !important;
}

.negative {
    color: #e74c3c !important;
    font-weight: 600 !important;
    background-color: rgba(231, 76, 60, 0.05) !important;
}
