/* style.css - Modernes Redesign v2.0 */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    padding: 32px 24px;
    color: var(--dark);
    line-height: 1.5;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Content Wrapper */
.content-wrapper {
    padding: 32px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 32px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--white);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header h1 i {
    font-size: 32px;
    opacity: 0.9;
}

.header-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
    font-weight: 400;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px 8px 20px;
    border-radius: 40px;
    backdrop-filter: blur(10px);
}

.user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.user-name i {
    font-size: 18px;
}

/* Profile Selector */
.profile-selector {
    background: var(--white);
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.profile-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--dark);
}

.profile-label i {
    color: var(--primary);
    font-size: 20px;
}

.profile-select {
    flex: 1;
    min-width: 280px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    color: var(--dark);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
}

.profile-select:hover {
    border-color: var(--primary-light);
}

.profile-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Month Picker */
.month-picker {
    background: var(--white);
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.month-picker label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--gray);
}

.month-picker label i {
    color: var(--primary);
}

.month-input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: var(--transition);
}

.month-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.month-actions {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 32px 0;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-icon.income {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: var(--primary-dark);
}

.stat-icon.expenses {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: var(--danger);
}

.stat-icon.savings {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: var(--secondary-dark);
}

.stat-icon i {
    font-size: 24px;
}

.stat-label {
    font-size: 14px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

.stat-value.positive {
    color: var(--secondary);
}

.stat-value.negative {
    color: var(--danger);
}

/* Sections */
.section {
    background: var(--white);
    border-radius: var(--radius-md);
    margin-bottom: 32px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.section-header {
    padding: 20px 24px;
    background: var(--light);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--primary);
    font-size: 20px;
}

.section-body {
    padding: 24px;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: var(--transition);
    background: var(--white);
}

.form-control:hover {
    border-color: var(--primary-light);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
    color: var(--dark);
    border: 2px solid var(--border);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border: 2px solid var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
    border: 2px solid var(--secondary);
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    border-color: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-outline {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-danger {
    background: var(--white);
    color: var(--danger);
    border: 2px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: var(--light);
    border-bottom: 2px solid var(--border);
}

th {
    text-align: left;
    padding: 16px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--dark);
}

tbody tr:hover {
    background: var(--light);
}

tfoot {
    background: var(--light);
    font-weight: 600;
}

tfoot td {
    padding: 16px;
    border-top: 2px solid var(--border);
}

/* Category Badges */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
}

.category-badge.wohnen {
    background: #e3f2fd;
    color: #1976d2;
}

.category-badge.essen {
    background: #e8f5e9;
    color: #388e3c;
}

.category-badge.freizeit {
    background: #fff3e0;
    color: #f57c00;
}

.category-badge.mobilität {
    background: #f3e5f5;
    color: #7b1fa2;
}

.category-badge.versicherung {
    background: #ffebee;
    color: #c62828;
}

.category-badge.sonstiges {
    background: #e0e0e0;
    color: #616161;
}

/* Action Buttons */
.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--gray);
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--light);
    color: var(--primary);
}

.action-btn.delete:hover {
    color: var(--danger);
}

.action-btn.edit:hover {
    color: var(--primary);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 24px 0;
}

.summary-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-md);
    padding: 24px;
    color: var(--white);
    text-align: center;
}

.summary-card:nth-child(2) {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
}

.summary-card:nth-child(3) {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
}

.summary-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 32px;
    font-weight: 700;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header i {
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--light);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

/* Message Notifications */
.message {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    color: var(--white);
    font-weight: 500;
    animation: slideInRight 0.3s ease;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
}

.message.success {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
}

.message.error {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
}

.message.info {
    background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
}

.message i {
    font-size: 20px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-grid,
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    .content-wrapper {
        padding: 20px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .dashboard-grid,
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .month-picker {
        flex-direction: column;
        align-items: stretch;
    }
    
    .month-actions {
        margin-left: 0;
        justify-content: stretch;
    }
    
    .month-actions .btn {
        flex: 1;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    .profile-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    td, th {
        padding: 12px 8px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .stat-value {
        font-size: 24px;
    }
    
    .summary-value {
        font-size: 24px;
    }
    
    .modal-content {
        width: 95%;
        margin: 16px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .header,
    .profile-selector,
    .month-picker,
    .btn,
    .action-btn,
    .modal {
        display: none !important;
    }
    
    .container {
        box-shadow: none;
        padding: 20px;
    }
    
    table {
        break-inside: avoid;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

.w-full { width: 100%; }