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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
    transition: filter 0.3s ease;
}

body.offline-mode {
    filter: saturate(0.8);
}

/* ===== Offline Status Bar ===== */
.offline-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.offline-banner.active {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.offline-banner::before {
    content: '⚠️';
    font-size: 18px;
}

.sync-status {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 14px;
    z-index: 9998;
    animation: slideIn 0.3s ease;
}

.sync-status.active {
    display: block;
}

.sync-status.success {
    border-left: 4px solid #51cf66;
    color: #2b8a3e;
}

.sync-status.error {
    border-left: 4px solid #ff6b6b;
    color: #c92a2a;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 140px);
}

/* ===== Navigation ===== */
 .navbar {
    background: #0f172a;
    background: linear-gradient(135deg, #0f172a 0%, #1e2a44 50%, #0f172a 100%);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    z-index: 1200;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
}

.nav-brand {
    font-size: 24px;
    font-weight: 800;
    color: #e0e7ff;
    text-decoration: none;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nav-brand::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22d3ee;
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.7);
}

.nav-menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 14px 12px;
    align-items: center;
    justify-content: flex-end;
    max-width: 780px;
}

.nav-menu a {
    text-decoration: none;
    color: #dbeafe;
    padding: 10px 14px;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #22d3ee;
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.5);
}

.logout-btn {
    color: #f87171 !important;
    background: rgba(248, 113, 113, 0.12);
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.35);
}

/* ===== Alerts ===== */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.alert-danger { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
.alert-info { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

/* ===== Login Page ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 400px;
    max-width: 90%;
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-header h1 {
    color: #333;
    font-size: 28px;
}

/* ===== Dashboard Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 48px;
}

.stat-content h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

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

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* ===== Forms ===== */
.form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* ===== Tables ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.data-table thead {
    background: #667eea;
    color: white;
}


.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table th,
.data-table td {
    word-break: break-word;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.members-table {
    min-width: 720px;
}

.fines-table {
    min-width: 640px;
}

.penalties-table {
    min-width: 700px;
}

.strafe-bezahlt {
    opacity: 0.6;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* ===== Actions Column ===== */
.actions {
    white-space: nowrap;
}

.actions form {
    display: inline;
}

.actions .btn {
    margin-right: 5px;
}

/* ===== Footer ===== */
.footer {
    background: rgba(255,255,255,0.95);
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: #666;
    font-size: 14px;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

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

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .table-responsive {
        margin: 0 -10px;
        padding: 0 10px;
    }

    .actions {
        white-space: normal;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .actions .btn {
        margin-right: 0;
    }
}

/* ===== Kegeltermine ===== */
.termine-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.termine-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.section-title {
    font-size: 24px;
    margin-bottom: 25px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.termine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.termin-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.termin-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.termin-kommend {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
}

.termin-vergangen {
    opacity: 0.7;
}

.termin-datum {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
}

.datum-tag {
    font-size: 36px;
    font-weight: bold;
    line-height: 1;
}

.datum-monat {
    font-size: 14px;
    text-transform: uppercase;
    margin-top: 5px;
}

.datum-zeit {
    font-size: 16px;
    margin-top: 10px;
    font-weight: 500;
}

.termin-info {
    flex: 1;
}

.termin-ort {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.termin-beschreibung {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.termin-stats {
    margin-top: 10px;
}

.termin-actions {
    display: flex;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.termin-actions form {
    flex: 1;
}

.termin-actions .btn {
    width: 100%;
}

.termin-voting {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #e0e0e0;
}

.voting-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.voting-form .voting-select {
    flex: 1;
    min-width: 150px;
}

.voting-form .btn {
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state p {
    font-size: 18px;
    margin-bottom: 20px;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

@media (max-width: 768px) {
    .termine-grid {
        grid-template-columns: 1fr;
    }
    
    .termin-actions {
        flex-direction: column;
    }
}

/* ===== Section Boxes ===== */
.section-box {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.alert-warning-box {
    border-left: 4px solid #ffc107;
    background: #fffbf0;
}

.total-row {
    background: #f8f9fa;
    font-weight: bold;
}

.total-row td {
    border-top: 2px solid #667eea !important;
}

/* ===== Kassen-Transaktionen ===== */
.transaktion-anfangsbestand {
    background: #e7f3ff;
}

.transaktion-einnahme {
    background: #f0fff4;
}

.transaktion-ausgabe {
    background: #fff5f5;
}

.kassenstand-card {
    border: 3px solid #667eea;
}

.text-success {
    color: #28a745;
}

.text-danger {
    color: #dc3545;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* ===== Kegelspiele ===== */
.kategorie-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.kegelspiele-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kegelspiel-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.kegelspiel-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.kegelspiel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.kegelspiel-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
    flex: 1;
}

.kegelspiel-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.meta-item {
    font-size: 14px;
    color: #666;
}

.meta-item strong {
    margin-right: 5px;
}

.kegelspiel-beschreibung {
    flex: 1;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Kegelspiel Detail */
.kegelspiel-detail {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.detail-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.badge-large {
    font-size: 16px;
    padding: 8px 16px;
    margin-bottom: 20px;
    display: inline-block;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.meta-box {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.meta-box strong {
    display: block;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.meta-box p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h2 {
    color: #333;
    font-size: 22px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.beschreibung-text {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.regeln-liste {
    list-style: none;
    counter-reset: regel-counter;
    padding: 0;
}

.regeln-liste li {
    counter-increment: regel-counter;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    position: relative;
    padding-left: 60px;
}

.regeln-liste li::before {
    content: counter(regel-counter);
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.varianten-section {
    background: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.varianten-section h2 {
    border-bottom-color: #ffc107;
}

.varianten-text {
    font-size: 15px;
    line-height: 1.6;
    color: #856404;
    margin: 0;
}

.detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

@media print {
    .navbar, .page-header .btn, .detail-actions {
        display: none;
    }
    
    .kegelspiel-detail {
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    .kegelspiele-grid {
        grid-template-columns: 1fr;
    }
    
    .kategorie-filter {
        justify-content: center;
    }
    
    .detail-meta {
        grid-template-columns: 1fr;
    }
}

/* ===== Mobile Optimierung für Strafeneingabe ===== */
@media (max-width: 768px) {
    .mobile-header h1 {
        font-size: 24px;
    }
    
    .mobile-optimized {
        padding: 20px 15px;
    }
    
    .mobile-form-group {
        margin-bottom: 25px;
    }
    
    .mobile-form-group label {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 10px;
        display: block;
    }
    
    .mobile-select,
    .mobile-input,
    .mobile-textarea {
        font-size: 16px !important; /* Verhindert Auto-Zoom auf iOS */
        padding: 14px 12px !important;
        min-height: 48px; /* Touch-Target-Größe */
        border: 2px solid #ddd !important;
        border-radius: 8px !important;
        width: 100%;
        -webkit-appearance: none;
        appearance: none;
    }
    
    .mobile-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 12px;
        padding-right: 40px !important;
    }
    
    .mobile-select:focus,
    .mobile-input:focus,
    .mobile-textarea:focus {
        border-color: #667eea !important;
        outline: none;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    .mobile-textarea {
        min-height: 100px;
        resize: vertical;
    }
    
    .mobile-form-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .help-text {
        display: block;
        margin-top: 8px;
        font-size: 14px;
        color: #666;
        line-height: 1.4;
    }
    
    .mobile-form-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 30px;
        position: sticky;
        bottom: 0;
        background: white;
        padding: 15px;
        margin-left: -15px;
        margin-right: -15px;
        margin-bottom: -20px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        border-radius: 15px 15px 0 0;
    }
    
    .mobile-btn-primary,
    .mobile-btn-secondary {
        width: 100%;
        min-height: 52px;
        font-size: 18px;
        font-weight: 600;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 20px;
        border: none;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .mobile-btn-primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    
    .mobile-btn-primary:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    }
    
    .mobile-btn-secondary {
        background: #f8f9fa;
        color: #666;
        border: 2px solid #ddd;
    }
    
    .mobile-btn-secondary:active {
        background: #e9ecef;
    }
    
    /* Container-Anpassungen für mobile */
    .container {
        padding: 10px;
    }
    
    .form {
        margin-bottom: 80px; /* Platz für Sticky-Buttons */
    }
    
    /* Bessere Touch-Targets für Checkboxen */
    input[type="checkbox"] {
        width: 24px;
        height: 24px;
        margin-right: 10px;
    }
    
    /* Optimierung der Navbar für mobile */
    .nav-menu {
        font-size: 13px;
    }
    
    .nav-menu a {
        padding: 6px 10px;
    }
}

/* ===== ABSTIMMUNGEN =====  */
.voting-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.voting-select:hover {
    border-color: #667eea;
}

.voting-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Readonly/auto-generated input styling */
.readonly-input[readonly] {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}
