/* Gemeinsame Styles für alle Trading Journal Seiten */

/* Basis-Layout */
body { 
    font-family: Arial, sans-serif; 
    background: #f4f4f4; 
    margin: 0;
    padding: 0;
}

.container { 
    max-width: 1200px; 
    margin: 40px auto; 
    background: #fff; 
    padding: 24px; 
    border-radius: 8px; 
    box-shadow: 0 0 10px #ccc; 
}

h2, h3 { 
    margin-bottom: 20px; 
    color: #333;
}

/* Formulare */
.form-group { 
    margin-bottom: 15px; 
}

label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold; 
    color: #555;
}

input[type="text"], 
input[type="number"], 
input[type="date"], 
textarea, 
select { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    box-sizing: border-box; 
    font-size: 14px;
}

input[type="text"]:focus, 
input[type="number"]:focus, 
input[type="date"]:focus, 
textarea:focus, 
select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Buttons */
button { 
    padding: 8px 16px; 
    background: #007bff; 
    color: #fff; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    margin-right: 5px; 
    font-size: 14px;
    transition: background-color 0.2s;
}

button:hover {
    background: #0056b3;
}

button.danger { 
    background: #dc3545; 
}

button.danger:hover {
    background: #c82333;
}

button.secondary { 
    background: #6c757d; 
}

button.secondary:hover {
    background: #545b62;
}

/* Status-Meldungen */
.success { 
    color: #155724; 
    background: #d4edda; 
    border: 1px solid #c3e6cb; 
    padding: 10px; 
    border-radius: 4px; 
    margin-bottom: 15px; 
}

.error { 
    color: #721c24; 
    background: #f8d7da; 
    border: 1px solid #f5c6cb; 
    padding: 10px; 
    border-radius: 4px; 
    margin-bottom: 15px; 
}

.warning {
    background: #fff3cd; 
    border: 1px solid #ffeaa7; 
    padding: 10px; 
    border-radius: 4px; 
    margin-bottom: 15px; 
    color: #856404;
}

/* Tabellen */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
    background: #fff;
}

th, td { 
    padding: 8px; 
    text-align: left; 
    border-bottom: 1px solid #ddd; 
}

th { 
    background-color: #f2f2f2; 
    font-weight: bold;
    color: #555;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Tooltips */
.tooltip { 
    position: relative; 
    cursor: help; 
}

.tooltip:hover::after { 
    content: attr(data-tooltip); 
    position: absolute; 
    background: #333; 
    color: #fff; 
    padding: 5px; 
    border-radius: 3px; 
    font-size: 12px; 
    white-space: pre-line; 
    z-index: 1000; 
    top: 100%;
    left: 0;
    min-width: 200px;
}

/* Icons */
.icon-info { 
    color: #007bff; 
    cursor: help; 
    font-weight: bold;
}

.icon-edit { 
    color: #28a745; 
    cursor: pointer; 
    font-weight: bold;
}

.icon-delete { 
    color: #dc3545; 
    cursor: pointer; 
    font-weight: bold;
}

/* Filter-Bereich */
.filters { 
    background: #f8f9fa; 
    padding: 15px; 
    border-radius: 5px; 
    margin-bottom: 20px; 
}

.filters .form-group { 
    display: inline-block; 
    margin-right: 15px; 
    margin-bottom: 10px; 
    vertical-align: top; 
}

.filters .form-group label { 
    font-size: 12px; 
    margin-bottom: 3px; 
}

.filters .form-group select, 
.filters .form-group input { 
    width: 120px; 
    padding: 5px; 
    font-size: 12px; 
}

.filters button { 
    padding: 5px 10px; 
    font-size: 12px; 
}

/* Sortierbare Spalten */
.sortable { 
    cursor: pointer; 
    user-select: none;
}

.sortable:hover { 
    background-color: #e9ecef; 
}

/* Spezielle Badges */
.expense-type { 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 12px; 
    font-weight: bold; 
}

.type-Gebühr { 
    background: #d4edda; 
    color: #155724; 
}

.type-Steuer { 
    background: #f8d7da; 
    color: #721c24; 
}

.type-Sonstige { 
    background: #fff3cd; 
    color: #856404; 
}

.source-type { 
    padding: 2px 6px; 
    border-radius: 3px; 
    font-size: 11px; 
    font-weight: bold; 
    background: #e2e3e5; 
    color: #383d41; 
}

/* Kalender Styles */
.calendar {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.calendar table {
    border-collapse: collapse;
    margin: 0;
}

.calendar th, .calendar td {
    padding: 5px;
    text-align: center;
    border: none;
    cursor: pointer;
}

.calendar th {
    background: #f8f9fa;
    font-weight: bold;
    color: #495057;
}

.calendar td:hover {
    background: #e9ecef;
}

.calendar td.selected {
    background: #007bff;
    color: white;
}

.calendar td.other-month {
    color: #ccc;
}

.calendar td.today {
    background: #28a745;
    color: white;
    font-weight: bold;
}

.calendar .calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.calendar .calendar-header button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 8px;
    color: #007bff;
}

.calendar .calendar-header button:hover {
    background: #e9ecef;
    border-radius: 4px;
}

.calendar .calendar-header .current-month {
    font-weight: bold;
    color: #495057;
}

/* Utility Classes */
.hidden { 
    display: none; 
}

.text-center { 
    text-align: center; 
}

.text-right { 
    text-align: right; 
}

.mb-0 { 
    margin-bottom: 0; 
}

.mt-3 { 
    margin-top: 1rem; 
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 0;
        box-shadow: none;
    }
    
    /* Filter-Bereich mobile-optimiert */
    .filters .form-group {
        display: block;
        margin-right: 0;
        margin-bottom: 15px;
        width: 100%;
    }
    
    .filters .form-group select, 
    .filters .form-group input {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
        border-radius: 8px;
    }
    
    /* Filter-Container mobile Layout */
    .filters > div[style*="display: flex"] {
        display: block !important;
    }
    
    .filters > div[style*="display: flex"] > div {
        width: 100% !important;
        margin-bottom: 15px;
    }
    
    /* Buttons mobile-optimiert */
    button {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px; /* Touch-Target Mindestgröße */
        border-radius: 8px;
        margin-bottom: 10px;
    }
    
    /* Tabellen mobile-optimiert */
    table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    th, td {
        padding: 8px 4px;
        min-width: 80px;
    }
    
    /* Formulare mobile-optimiert */
    input[type="text"], 
    input[type="number"], 
    input[type="date"], 
    textarea, 
    select {
        padding: 12px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
        border-radius: 8px;
        min-height: 44px; /* Touch-Target Mindestgröße */
    }
    
    textarea {
        min-height: 100px;
    }
    
    /* Kalender mobile-optimiert */
    .calendar {
        width: 90vw;
        max-width: 350px;
        left: 50% !important;
        transform: translateX(-50%);
        font-size: 16px;
    }
    
    .calendar td {
        padding: 12px 8px;
        min-height: 44px;
        font-size: 16px;
    }
    
    .calendar th {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    /* Tooltips auf Mobile deaktivieren */
    .tooltip:hover::after {
        display: none;
    }
    
    /* Icons mobile-optimiert */
    .icon-edit, .icon-delete, .icon-info {
        font-size: 20px;
        padding: 8px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Action-Buttons in Tabellen */
    .action-buttons {
        white-space: nowrap;
    }
    
    .action-buttons form {
        display: inline-block;
        margin-right: 5px;
    }
    
    /* H2/H3 mobile-optimiert */
    h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    h3 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    /* Statistiken mobile-optimiert */
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-number {
        font-size: 1.2em;
    }
    
    /* Paginierung mobile-optimiert */
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .page-navigation {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 10px 14px;
        font-size: 16px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Extra kleine Bildschirme (unter 480px) */
@media (max-width: 480px) {
    .container {
        margin: 5px;
        padding: 10px;
    }
    
    /* Tabellen noch kompakter */
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 6px 2px;
        min-width: 60px;
    }
    
    /* Buttons noch größer */
    button {
        width: 100%;
        margin-bottom: 15px;
    }
    
    /* Form-Rows auf Mobile */
    .form-row {
        display: block !important;
    }
    
    .form-row > div {
        width: 100% !important;
        margin-bottom: 15px;
    }
}
