/* ===================================
   Tipp-Übersicht - Modernes Design
   Erstellt: 27. Oktober 2025
   Mobile-First, Responsive Design
   =================================== */

/* ===== CSS-Variablen ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --bg-dark: #0f172a;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== Navigation ===== */
.navbar {
    background: var(--surface-color);
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.navbar-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand img {
    transition: var(--transition);
}

.navbar-brand img:hover {
    transform: scale(1.1) rotate(5deg);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-info:hover {
    color: var(--primary-color);
    transform: translateY(-1px);
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    margin-right: 1rem;
}

.back-link:hover {
    color: var(--primary-dark);
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ===== Statistik-Karten ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 1rem;
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card-primary {
    border-left-color: var(--primary-color);
}

.stat-card-success {
    border-left-color: var(--success-color);
}

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-value.positive {
    color: var(--success-color);
}

.stat-value.negative {
    color: var(--danger-color);
}

.stat-detail {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Jahr-Auswahl ===== */
.year-selector {
    margin-bottom: 2rem;
}

.year-selector h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.year-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.year-tab {
    padding: 0.75rem 1.5rem;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
}

.year-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

/* ===== Monatsübersicht ===== */
.months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.month-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.month-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.month-card.current-month {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
}

.month-card.has-data {
    border-left: 4px solid var(--primary-color);
}

.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.month-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

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

.month-profit {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.month-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Monatsdetail ===== */
.month-stats-detail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
    padding: 0.75rem;
}

.stat-item .stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-item .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

/* ===== Action Bar ===== */
.action-bar {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Tabellen ===== */
.table-container {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.tipps-table {
    width: 100%;
    border-collapse: collapse;
}

.tipps-table thead {
    background: var(--bg-color);
}

.tipps-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tipps-table td {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.tipps-table tbody tr {
    transition: var(--transition);
}

.tipps-table tbody tr:hover {
    background: var(--bg-color);
}

.tipps-table .positive {
    color: var(--success-color);
    font-weight: 600;
}

.tipps-table .negative {
    color: var(--danger-color);
    font-weight: 600;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-current {
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
}

/* ===== Buttons ===== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition);
    opacity: 0.7;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.2);
}

.btn-edit:hover {
    filter: hue-rotate(45deg);
}

.btn-delete:hover {
    filter: hue-rotate(-45deg);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger-color);
    transform: rotate(90deg);
}

.modal-content form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ===== Formulare ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:read-only {
    background: var(--bg-color);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ===== Login-Seite ===== */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
}

.login-box {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    opacity: 0.9;
}

.login-form {
    padding: 2rem;
}

.login-footer {
    padding: 1rem 2rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

/* ===== Toast Notifications ===== */
#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    min-width: 250px;
    border-left: 4px solid var(--primary-color);
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left-color: var(--success-color);
}

.toast-error {
    border-left-color: var(--danger-color);
}

.toast-warning {
    border-left-color: var(--warning-color);
}

/* ===== Responsive Design ===== */

/* Tablets */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .container {
        padding: 1rem;
    }
    
    .navbar {
        position: sticky;
        top: 0;
    }
    
    .navbar-brand h1 {
        font-size: 1.25rem;
    }
    
    .navbar-brand img {
        width: 32px !important;
        height: 32px !important;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .months-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .month-stats-detail {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Responsive Tabelle */
    .tipps-table thead {
        display: none;
    }
    
    .tipps-table,
    .tipps-table tbody,
    .tipps-table tr,
    .tipps-table td {
        display: block;
    }
    
    .tipps-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        overflow: hidden;
    }
    
    .tipps-table td {
        display: flex;
        justify-content: space-between;
        padding: 0.75rem;
        border-top: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .tipps-table td:last-child {
        border-bottom: none;
    }
    
    .tipps-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.875rem;
    }
    
    .action-buttons {
        justify-content: flex-end;
        width: 100%;
    }
    
    #toast-container {
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
    }
}

/* Mobile */
@media (max-width: 480px) {
    html {
        font-size: 16px;
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .navbar .container {
        flex-direction: row;
        align-items: center;
        padding: 0.75rem 1rem;
    }
    
    .navbar-brand {
        display: flex;
        align-items: center;
    }
    
    .navbar-brand h1 {
        font-size: 1.1rem;
    }
    
    .navbar-brand img {
        width: 28px !important;
        height: 28px !important;
        margin-right: 0.5rem !important;
    }
    
    .navbar-menu {
        gap: 0.5rem;
    }
    
    .user-info {
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Statistiken */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Monate Grid */
    .months-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .month-card {
        padding: 1rem;
    }
    
    .month-profit {
        font-size: 1.35rem;
    }
    
    /* Monatsdetail Statistiken */
    .month-stats-detail {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .stat-item .stat-value {
        font-size: 1.35rem;
    }
    
    /* Buttons größer für Touch */
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .btn-icon {
        font-size: 1.5rem;
        padding: 0.75rem;
        min-width: 48px;
        min-height: 48px;
    }
    
    /* Jahr-Tabs */
    .year-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .year-tab {
        padding: 0.75rem 1.25rem;
        white-space: nowrap;
    }
    
    /* Modal auf Mobile */
    .modal-content {
        width: 95%;
        max-height: 95vh;
        margin: auto;
    }
    
    .modal-header,
    .modal-content form,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    /* Login-Seite Mobile */
    .login-page {
        padding: 1rem;
    }
    
    .login-container {
        padding: 0;
    }
    
    .login-box {
        border-radius: 16px;
    }
    
    .login-header {
        padding: 1.5rem;
    }
    
    .login-header h1 {
        font-size: 2rem;
    }
    
    .login-form {
        padding: 1.5rem;
    }
    
    .login-form input,
    .login-form select {
        font-size: 16px; /* Verhindert Zoom auf iOS */
        padding: 0.875rem;
        min-height: 48px;
    }
    
    /* Toast auf Mobile */
    #toast-container {
        right: 10px;
        left: 10px;
        top: 70px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    /* Action Bar */
    .action-bar {
        position: sticky;
        top: 65px;
        background: var(--bg-color);
        padding: 0.75rem 0;
        z-index: 50;
        margin-bottom: 1rem;
    }
    
    /* Verbesserte Touch-Targets */
    a, button, input, select, textarea {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.1);
    }
    
    /* Smooth Scrolling */
    html {
        scroll-behavior: smooth;
    }
}

/* ===== Druckansicht ===== */
@media print {
    .navbar,
    .action-bar,
    .action-buttons,
    #toast-container {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .container {
        max-width: 100%;
    }
    
    .stat-card,
    .month-card,
    .table-container {
        box-shadow: none;
        border: 1px solid var(--border-color);
        break-inside: avoid;
    }
}
