/* KegelVerein Pro - Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.logo {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-100);
}

.user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-900);
}

.user-role {
    font-size: 12px;
    color: var(--gray-500);
}

/* Main Content */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--gray-100);
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
}

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

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

/* Event List */
.event-list {
    padding: 8px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.event-item:hover {
    background: var(--gray-50);
}

.event-date {
    width: 48px;
    text-align: center;
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 8px 4px;
}

.event-day {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.event-month {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 600;
}

.event-info {
    flex: 1;
}

.event-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.event-meta {
    font-size: 13px;
    color: var(--gray-500);
}

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

/* Leaderboard */
.leaderboard {
    padding: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
}

.leaderboard-item.header {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    padding-bottom: 8px;
}

.leaderboard-item:not(.header):hover {
    background: var(--gray-50);
}

.rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-100);
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: white;
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: white;
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: white;
}

.player {
    flex: 1;
    font-weight: 500;
    color: var(--gray-800);
}

.score {
    font-weight: 600;
    color: var(--gray-600);
}

.score.highlight {
    color: var(--primary);
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 2px;
    width: 320px;
}

.search-input {
    flex: 1;
    border: none;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.search-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
}

.filter-group {
    display: flex;
    gap: 12px;
}

.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    color: var(--gray-700);
    cursor: pointer;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

.data-table tr:hover td {
    background: var(--gray-50);
}

.member-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.member-name {
    font-weight: 600;
    color: var(--gray-800);
}

.member-email {
    font-size: 13px;
    color: var(--gray-500);
}

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

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
}

.status-badge.paid {
    color: var(--success);
}

.status-badge.pending {
    color: var(--warning);
}

.status-badge.overdue {
    color: var(--danger);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding: 16px;
}

.page-info {
    font-size: 14px;
    color: var(--gray-600);
}

/* Calendar */
.view-toggle {
    display: flex;
    gap: 8px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 8px;
}

.calendar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.calendar {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    padding: 8px;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.calendar-day:hover {
    background: var(--gray-100);
}

.calendar-day.has-event {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 4px;
}

.event-dot.event-primary {
    background: var(--primary);
}

.event-dot.event-warning {
    background: var(--warning);
}

.event-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 10;
    margin-bottom: 8px;
}

.calendar-day:hover .event-tooltip {
    opacity: 1;
    visibility: visible;
}

.event-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--gray-900);
}

/* Results */
.results-list {
    padding: 8px;
}

.result-item {
    padding: 16px;
    border-bottom: 1px solid var(--gray-100);
}

.result-item:last-child {
    border-bottom: none;
}

.result-date {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.result-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
}

.result-scores {
    display: flex;
    gap: 16px;
}

.result-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.result-player .name {
    font-size: 12px;
    color: var(--gray-500);
}

.result-player .score {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

/* Finance Chart */
.finance-chart {
    padding: 20px;
}

.chart-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.chart-label {
    width: 40px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

.chart-bar-bg {
    flex: 1;
    height: 24px;
    background: var(--gray-100);
    border-radius: 12px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    transition: width 0.5s ease;
}

.chart-value {
    width: 70px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.finance-summary {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-100);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--gray-600);
}

.summary-row.total {
    border-top: 1px solid var(--gray-200);
    margin-top: 8px;
    padding-top: 16px;
    font-weight: 600;
    color: var(--gray-800);
    font-size: 15px;
}

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

.warning {
    color: var(--warning);
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-800);
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

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

/* Utilities */
.mt-4 {
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main {
        margin-left: 0;
    }
    
    .app {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
}
