/* Marktverwaltungssystem - Stylesheet */

/* Grundlegende Styles */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header und Navigation */
header {
    background-color: var(--secondary-color);
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

header h1 {
    margin-bottom: 1rem;
}

nav ul {
    display: flex;
    list-style: none;
    flex-wrap: wrap;
}

nav ul li {
    margin-right: 1rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

nav ul li a:hover {
    background-color: var(--primary-color);
    border-radius: 4px;
}

/* Main Content */
main {
    min-height: calc(100vh - 180px);
    padding-bottom: 2rem;
}

/* Footer */
footer {
    background-color: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Formulare */
form {
    background-color: white;
    padding: 1.5rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

button, .btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

button:hover, .btn:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: var(--success-color);
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-danger {
    background-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* Tabellen */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: var(--secondary-color);
    color: white;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #e9e9e9;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Cards */
.card {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem;
    background-color: var(--secondary-color);
    color: white;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.card-body {
    padding: 1rem;
}

/* Action Buttons */
.actions-cell {
    min-width: 180px;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.action-buttons .btn-sm {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Collapsible Sections */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-header h3 {
    margin: 0;
}

.collapsible-content {
    display: none;
}

.collapsible-content.show {
    display: block;
}

.toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.toggle-btn:focus {
    outline: none;
}

/* Income Tables */
.income-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.income-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.income-table th,
.income-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
}

.income-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.income-table tr:hover {
    background-color: #e9e9e9;
}

.income-total {
    font-weight: bold;
    color: var(--primary-color);
}

.income-total-row {
    background-color: #e6f2ff !important;
}

.text-right {
    text-align: right;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-6, .col-md-12 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Hamburger Menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle:focus {
    outline: none;
}

/* Table Styles */
.responsive-table {
    width: 100%;
}

.fixed-table {
    width: 100%;
}

/* List Styling */
ol.calculation-list {
    padding-left: 2rem;
    margin: 1.5rem 0;
}

ol.calculation-list li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.calculation-explanation {
    margin: 1.5rem 0;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    /* Navigation */
    .menu-toggle {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
    
    nav {
        width: 100%;
    }
    
    nav ul {
        display: none;
        flex-direction: column;
        width: 100%;
        padding-top: 1rem;
    }
    
    nav ul.show {
        display: flex;
    }
    
    nav ul li {
        margin-right: 0;
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    nav ul li a {
        display: block;
        padding: 0.75rem;
        text-align: left;
        border-radius: 0;
    }
    
    /* Tables */
    .responsive-table, 
    .responsive-table thead, 
    .responsive-table tbody, 
    .responsive-table th, 
    .responsive-table td, 
    .responsive-table tr {
        display: block;
        width: 100%;
    }
    
    /* Hide table headers for responsive tables */
    .responsive-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .responsive-table tr {
        margin-bottom: 1rem;
        border: 1px solid #ddd;
    }
    
    .responsive-table td {
        border: none;
        border-bottom: 1px solid #ddd;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }
    
    .responsive-table td:before {
        position: absolute;
        top: 0.75rem;
        left: 0.75rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        content: attr(data-label);
    }
    
    /* Fixed tables remain as normal tables in mobile view */
    .fixed-table {
        display: table;
        width: 100%;
        overflow-x: auto;
    }
    
    .fixed-table thead {
        display: table-header-group;
    }
    
    .fixed-table tbody {
        display: table-row-group;
    }
    
    .fixed-table tr {
        display: table-row;
        margin-bottom: 0;
        border: none;
    }
    
    .fixed-table th, 
    .fixed-table td {
        display: table-cell;
        padding: 0.75rem;
        text-align: left;
        border-bottom: 1px solid #ddd;
    }
    
    /* Cards */
    .card {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Container */
    .container {
        padding: 0 10px;
    }
    
    /* Buttons */
    .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
        text-align: center;
    }
    
    .btn-sm {
        display: inline-block;
        width: auto;
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .action-buttons {
        justify-content: flex-end;
    }
    
    .action-buttons .btn-sm {
        margin-bottom: 0;
    }
    
    /* Form elements */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}
