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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    padding-bottom: 50px;
}

/* === HEADER === */
.header {
    background: #475569;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.5em;
    font-weight: 500;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    font-size: 0.9em;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* === NAVIGATION === */
.tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 0 20px;
    overflow-x: auto;
}

.tab {
    padding: 15px 25px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    text-decoration: none;
}

.tab:hover {
    color: #2c5aa0;
    background: #f8f9fa;
}

.tab.active {
    color: #2c5aa0;
    border-bottom-color: #2c5aa0;
}

/* === CONTENT === */
.content {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* === CARDS === */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 {
    color: #2c5aa0;
    font-size: 1.1em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* === FORMULARE === */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

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

.form-group.wide {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2c5aa0;
}

/* === BUTTONS === */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #2c5aa0;
    color: white;
}

.btn-primary:hover {
    background: #1e3a6e;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

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

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

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

.btn-success:hover {
    background: #1e7e34;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85em;
}

/* === TABELLEN === */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

tr:hover {
    background: #f8f9fa;
}

.table-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
}

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

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

/* === ZUSAMMENFASSUNGEN === */
.summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-top: 15px;
}

.summary-bar .total {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c5aa0;
}

/* === ZWEI SPALTEN === */
.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .two-columns {
        grid-template-columns: 1fr;
    }
}

/* === ERGEBNIS-BOX === */
.result-box {
    padding: 20px;
    background: #475569;
    color: white;
    border-radius: 10px;
    text-align: center;
    margin-top: 20px;
}

.result-box .label {
    font-size: 0.9em;
    opacity: 0.9;
}

.result-box .value {
    font-size: 2em;
    font-weight: 600;
    margin-top: 5px;
}

.result-box.gewinn {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.result-box.verlust {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* === STATUS BAR === */
.status-bar {
    background: #333;
    color: #aaa;
    padding: 8px 20px;
    font-size: 0.85em;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}

/* === FLASH MESSAGES === */
.flash {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

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

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

.flash-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* === LOGIN === */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.login-card h1 {
    color: #2c5aa0;
    text-align: center;
    margin-bottom: 30px;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .btn {
    width: 100%;
    margin-top: 10px;
}

.login-card .links {
    text-align: center;
    margin-top: 20px;
}

.login-card .links a {
    color: #2c5aa0;
}

/* === MWST PREVIEW === */
.mwst-preview {
    color: #28a745;
    font-weight: 500;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 5px;
    display: flex;
    align-items: center;
}

/* === DELETE BUTTON === */
.delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1.1em;
    padding: 5px;
}

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

/* === SECTION TITLE === */
.section-title {
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #2c5aa0;
}

/* === FARBEN === */
.positive { color: #28a745; }
.negative { color: #dc3545; }

/* === TOOLBAR === */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* === BENUTZER TABELLE === */
.role-select {
    padding: 5px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

/* === MOBILE OPTIMIERUNG === */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }
    
    .header h1 {
        font-size: 1.2em;
    }
    
    .header-info {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 10px;
    }
    
    .tab {
        font-size: 0.85em;
        padding: 12px 15px;
    }
    
    .content {
        padding: 10px;
    }
    
    .card {
        padding: 15px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group.wide {
        grid-column: span 1;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.8em;
    }
    
    th, td {
        padding: 8px 5px;
    }
    
    .toolbar {
        flex-direction: column;
    }
    
    .toolbar .btn,
    .toolbar form {
        width: 100%;
    }
    
    .status-bar {
        font-size: 0.75em;
        padding: 6px 10px;
    }
}

/* === TOUCH-OPTIMIERUNG === */
@media (hover: none) and (pointer: coarse) {
    /* Größere Touch-Targets auf Mobilgeräten */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .tab {
        min-height: 44px;
    }
    
    input, select {
        min-height: 44px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
}
