/* Reset und Basis-Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: #1a5f3f;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}


/* Hauptinhalt */
main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Rangliste */
.rangliste-container {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.rangliste-container h1 {
    margin-bottom: 0.5rem;
    color: #1a5f3f;
}

.last-update {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.table-wrapper {
    overflow-x: auto;
}

.rangliste-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.rangliste-table thead {
    background-color: #1a5f3f;
    color: white;
}

.rangliste-table th,
.rangliste-table td {
    padding: 0.75rem;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.rangliste-table th {
    font-weight: 600;
}

.rangliste-table th.gesamt,
.rangliste-table td.gesamt,
.rangliste-table th.durchschnitt,
.rangliste-table td.durchschnitt {
    background-color: #e8f5e9;
    font-weight: bold;
    font-size: 1.1rem;
    color: #1a5f3f;
}

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

.rangliste-table td.rang {
    font-weight: bold;
    color: #1a5f3f;
}

.rangliste-table td.name {
    text-align: left;
    font-weight: 500;
}

.rangliste-table td.monat {
    min-width: 60px;
}

.rangliste-table td.monat .empty {
    color: #ccc;
    font-weight: normal;
}

/* Editierbare Zellen */
.editable-result,
.editable-name {
    display: inline-block;
    min-width: 30px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.editable-result:hover,
.editable-name:hover {
    background-color: #e8f5e9;
    cursor: text;
}

.editable-result:focus,
.editable-name:focus {
    background-color: #c8e6c9;
    outline: 2px solid #1a5f3f;
    outline-offset: -2px;
}

.editable-result[contenteditable="true"]:empty:before,
.editable-result-mobile[contenteditable="true"]:empty:before {
    content: '-';
    color: #ccc;
}

.editable-result-mobile {
    display: inline-block;
    min-width: 30px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
    cursor: text;
}

.editable-result-mobile:hover {
    background-color: #e8f5e9;
}

.editable-result-mobile:focus {
    background-color: #c8e6c9;
    outline: 2px solid #1a5f3f;
    outline-offset: -2px;
}

.editable-name-mobile {
    display: inline-block;
    min-width: 50px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
    cursor: text;
}

.editable-name-mobile:hover {
    background-color: #e8f5e9;
}

.editable-name-mobile:focus {
    background-color: #c8e6c9;
    outline: 2px solid #1a5f3f;
    outline-offset: -2px;
}

.btn-delete-schuetze-mobile {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn-delete-schuetze-mobile:hover {
    background-color: #c0392b;
}

.btn-delete-schuetze {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn-delete-schuetze:hover {
    background-color: #c0392b;
}

.new-row {
    background-color: #fff3cd;
}

.new-schuetze-name {
    font-size: 1rem;
}

#btn-add-row {
    margin: 1rem 0;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #666;
}

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

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin-bottom: 1.5rem;
    color: #1a5f3f;
    text-align: center;
}

.login-hint {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

.login-hint code {
    background-color: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
}


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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #1a5f3f;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a5f3f;
    box-shadow: 0 0 0 3px rgba(26, 95, 63, 0.1);
}


/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #1a5f3f;
    color: white;
}

.btn-primary:hover {
    background-color: #144a32;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}


/* Footer */
footer {
    background-color: #1a5f3f;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

footer p {
    margin: 0;
}

footer a {
    color: white;
    text-decoration: underline;
    transition: opacity 0.3s;
    margin: 0 0.25rem;
}

footer a:hover {
    opacity: 0.8;
}

footer p {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

/* Mobile-Karten für Rangliste */
.mobile-cards {
    display: none;
}

/* Standard: Desktop-Tabelle anzeigen, Mobile-Karten ausblenden */
.desktop-table {
    display: block;
}

.admin-buttons-container {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.rangliste-card {
    background: white;
    border-radius: 4px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.card-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.card-current-month {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.card-month-label {
    color: #666;
    font-weight: 500;
}

.card-month-value {
    font-weight: bold;
    color: #1a5f3f;
    min-width: 1.5rem;
    text-align: right;
}

.card-rang {
    background-color: #1a5f3f;
    color: white;
    font-weight: bold;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    min-width: 2rem;
    text-align: center;
    flex-shrink: 0;
}

.card-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #1a5f3f;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-gesamt {
    font-weight: bold;
    font-size: 0.9rem;
    color: #1a5f3f;
    min-width: 2.5rem;
    text-align: right;
}

.card-durchschnitt {
    font-weight: 500;
    font-size: 0.85rem;
    color: #666;
    min-width: 3rem;
    text-align: right;
}

.card-months {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.month-item {
    text-align: center;
    padding: 0.25rem 0.15rem;
    background-color: #f8f9fa;
    border-radius: 3px;
}

.month-item.current-month {
    background-color: #e8f5e9;
    border: 2px solid #1a5f3f;
    font-weight: bold;
}

.month-label {
    display: block;
    font-size: 0.65rem;
    color: #666;
    margin-bottom: 0.15rem;
    font-weight: 500;
}

.month-value {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    color: #1a5f3f;
}

.month-value:contains('-') {
    color: #ccc;
}

.btn-toggle-months {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.4rem;
    background-color: #4a7c59;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s;
}

.btn-toggle-months:hover {
    background-color: #1a5f3f;
}

.toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .rangliste-container {
        padding: 1rem;
    }
    
    
    /* Desktop-Tabelle auf mobilen Geräten ausblenden */
    .desktop-table {
        display: none !important;
    }
    
    /* Mobile-Karten auf mobilen Geräten anzeigen */
    .mobile-cards {
        display: block !important;
    }
    
    .admin-buttons-container {
        flex-direction: column;
    }
    
    .admin-buttons-container .btn {
        width: 100%;
    }
    
    .card-months {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 769px) {
    /* Mobile-Karten auf Desktop ausblenden */
    .mobile-cards {
        display: none !important;
    }
    
    .mobile-admin-buttons {
        display: none !important;
    }
    
    /* Desktop-Tabelle auf Desktop anzeigen */
    .desktop-table {
        display: block !important;
    }
}
