/* Jahresmeisterschaft Frontend */
.jm-wrap {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Tabs */
.jm-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 24px;
}

.jm-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.jm-tab:hover {
    color: #333;
}

.jm-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.jm-tab-content {
    display: none;
}

.jm-tab-content.active {
    display: block;
}

/* Ranking Table */
.jm-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.jm-ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.jm-ranking-table thead th {
    background: #1e293b;
    color: #fff;
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    vertical-align: bottom;
}

.jm-ranking-table thead th.jm-col-name {
    text-align: left;
    min-width: 160px;
    padding: 12px 8px;
    color: #ffffff;
}

.jm-ranking-table thead th.jm-col-rank {
    width: 40px;
    padding: 12px 4px;
    color: #ffffff;
}

.jm-ranking-table thead th.jm-col-event {
    padding: 4px 2px;
    vertical-align: bottom;
}

.jm-ranking-table thead th.jm-col-total {
    background: #0f172a;
    padding: 12px 8px;
    color: #ffffff;
}

.jm-ranking-table tbody td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.jm-ranking-table tbody td.jm-col-name {
    text-align: left;
    font-weight: 500;
}

.jm-ranking-table tbody td.jm-col-rank {
    font-weight: 700;
    color: #64748b;
}

.jm-ranking-table tbody td.jm-col-total {
    background: #f8fafc;
    font-size: 15px;
}

.jm-ranking-table tbody tr:hover {
    background: #f1f5f9;
}

.jm-ranking-table tbody tr:nth-child(-n+3) .jm-col-rank {
    color: #d97706;
    font-size: 16px;
}

.jm-no-points {
    color: #d1d5db;
}

.jm-points {
    cursor: default;
}

.jm-event-header-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 120px;
}

.jm-event-header {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: block;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: #fff;
    max-height: 115px;
    overflow: hidden;
    text-align: left;
}

/* Events List */
.jm-month-group {
    margin-bottom: 24px;
}

.jm-month-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 12px;
}

.jm-event-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: box-shadow 0.2s;
}

.jm-event-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.jm-event-past {
    opacity: 0.7;
}

.jm-event-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.jm-event-date {
    font-weight: 600;
    color: #475569;
    min-width: 80px;
}

.jm-event-name {
    font-weight: 600;
    color: #1e293b;
}

.jm-event-type {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.jm-type-competition {
    background: #fef3c7;
    color: #92400e;
}

.jm-type-participation {
    background: #d1fae5;
    color: #065f46;
}

.jm-event-results-count {
    font-size: 12px;
    color: #94a3b8;
}

.jm-event-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Buttons */
.jm-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.jm-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.jm-btn-primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.jm-btn-primary:hover {
    background: #1d4ed8;
}

.jm-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.jm-btn-small {
    padding: 4px 12px;
    font-size: 13px;
}

.jm-btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.jm-btn-danger:hover {
    background: #fecaca;
}

.jm-token-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: #eff6ff;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
}

/* Archive */
.jm-archive-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.jm-archive-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: #1e293b;
    font-weight: 700;
    font-size: 18px;
    transition: all 0.2s;
}

.jm-archive-item:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37,99,235,0.1);
}

.jm-archive-active {
    border-color: #2563eb;
    background: #eff6ff;
}

.jm-archive-badge {
    font-size: 11px;
    background: #2563eb;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* Modal */
.jm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.jm-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.jm-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: none;
    background: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    z-index: 1;
}

.jm-modal-close:hover {
    color: #1e293b;
}

.jm-modal-content {
    padding: 24px;
}

.jm-modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    color: #1e293b;
}

/* Modal Form */
.jm-form-group {
    margin-bottom: 16px;
}

.jm-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #374151;
    font-size: 14px;
}

.jm-form-group input,
.jm-form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

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

.jm-form-row {
    display: flex;
    gap: 12px;
}

.jm-form-row .jm-form-group {
    flex: 1;
}

/* Results Edit Table */
.jm-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 16px 0;
}

.jm-results-table thead th {
    background: #f8fafc;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.jm-results-table tbody td {
    padding: 6px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.jm-results-table tbody tr:hover {
    background: #f8fafc;
}

.jm-results-table input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-align: center;
}

.jm-results-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.jm-results-table .jm-points-display {
    font-weight: 600;
    color: #2563eb;
    min-width: 40px;
    display: inline-block;
    text-align: center;
}

.jm-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.jm-empty {
    color: #94a3b8;
    font-style: italic;
    padding: 20px 0;
}

.jm-msg {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}

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

.jm-msg-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Responsive */
@media (max-width: 768px) {
    .jm-tabs {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .jm-tabs::-webkit-scrollbar {
        display: none;
    }

    .jm-tab {
        padding: 10px 16px;
        font-size: 14px;
        white-space: nowrap;
    }

    .jm-event-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .jm-event-actions {
        width: 100%;
    }

    .jm-event-actions .jm-btn {
        flex: 1;
        text-align: center;
    }

    .jm-token-actions {
        flex-direction: column;
    }

    .jm-form-row {
        flex-direction: column;
    }

    .jm-ranking-table {
        font-size: 12px;
    }

    .jm-ranking-table thead th,
    .jm-ranking-table tbody td {
        padding: 6px 4px;
    }
}
