@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --primary: #0a4b8c;
    --primary-light: #1a6fc4;
    --primary-bg: #e8f0fe;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-light: #f87171;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.nav-icon { font-size: 1.4rem; }
.nav-links { display: flex; gap: 0.25rem; margin-left: 2rem; flex: 1; }
.nav-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.15); color: white; }
.nav-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; }
.nav-username { font-weight: 600; }
.nav-toggle { display: none; background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }

/* Main */
.main-content { max-width: 1400px; margin: 0 auto; padding: 1.5rem; min-width: 0; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }
.back-link { color: var(--primary); text-decoration: none; font-size: 0.85rem; display: inline-block; margin-bottom: 0.25rem; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.stat-card.stat-danger { border-left-color: var(--danger); }
.stat-card.stat-warning { border-left-color: var(--warning); }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* Team Grid */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.team-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: all 0.2s;
    border: 2px solid transparent;
}
.team-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.team-card h3 { font-size: 1.2rem; margin-bottom: 0.75rem; color: var(--primary); }
.team-card-stats { display: flex; gap: 1.5rem; }
.team-card-stat { text-align: center; }
.stat-big { display: block; font-size: 1.5rem; font-weight: 700; }
.stat-small { font-size: 0.75rem; color: var(--text-secondary); }

/* Team list (dashboard) */
.team-row { display: flex; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.team-row:hover { background: var(--primary-bg); margin: 0 -0.5rem; padding-left: 0.5rem; padding-right: 0.5rem; border-radius: 6px; }
.team-count { color: var(--text-secondary); font-size: 0.85rem; }

/* Expiring list */
.expiring-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.expiring-info { display: flex; flex-direction: column; }
.expiring-info small { color: var(--text-secondary); font-size: 0.8rem; }

/* Tables */
.table-responsive { overflow-x: auto; width: 100%; max-width: 100%; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: var(--primary); color: white; padding: 0.75rem; text-align: left; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.data-table td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; overflow-wrap: anywhere; }
.data-table tbody tr:hover { background: var(--primary-bg); }
.row-expired { background: var(--danger-bg) !important; }
.row-expired:hover { background: #fde8e8 !important; }
.row-warning { background: var(--warning-bg) !important; }
.text-danger-bold { color: var(--danger); font-weight: 700; }

/* Verfügbarkeits-Icons */
.icon-cell { text-align: center; font-size: 0.9rem; }
.icon-available { opacity: 1; }
.icon-missing { opacity: 0.15; }

/* Einzellizenz-Status */
.lizenz-red { color: #dc2626; font-weight: bold; }
.lizenz-orange { color: #f59e0b; font-weight: bold; }
.lizenz-green { color: #16a34a; }
.lizenz-gray { opacity: 0.2; }
.icon-link { text-decoration: none; }
.icon-link:hover { opacity: 0.7; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-danger { background: var(--danger); color: white; }
.badge-warning { background: var(--warning); color: white; }
.badge-success { background: var(--success); color: white; }
.badge-secondary { background: #9ca3af; color: white; }
.badge-primary { background: var(--primary); color: white; }
.badge-admin { background: #7c3aed; color: white; }
.badge-editor { background: var(--primary); color: white; }
.badge-mannschaftsfuehrer { background: #0d9488; color: white; }
.badge-spielereditor { background: #0891b2; color: white; }
.badge-viewer { background: #6b7280; color: white; }
.badge-rolle-spieler { background: var(--primary-bg); color: var(--primary); }
.badge-rolle-trainer { background: #fef3c7; color: #92400e; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem; border: none; border-radius: 6px;
    font-family: inherit; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); padding: 0.25rem 0.5rem; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* Filter Bar */
.filter-bar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; background: var(--surface); padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-form { display: flex; gap: 0.5rem; flex-wrap: wrap; flex: 1; }
.filter-input, .filter-select {
    padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px;
    font-family: inherit; font-size: 0.85rem; background: white;
}
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.filter-count { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; }

/* Forms */
.form-group { margin-bottom: 0.6rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.15rem; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.4rem 0.6rem; border: 1px solid var(--border);
    border-radius: 6px; font-family: inherit; font-size: 0.85rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200; }
.modal[style*="flex"] { display: flex !important; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 1; }
.modal-content {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border-radius: var(--radius);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 2;
}
.modal-large {
    max-width: 860px;
    overflow: hidden;
    min-width: 380px;
    min-height: 320px;
}
.modal-large .modal-body,
.modal-large #modalBody {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
/* Resize-Griff */
.modal-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 22px;
    height: 22px;
    cursor: se-resize;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 3px;
    border-radius: 0 0 var(--radius) 0;
}
.modal-resize-handle svg {
    opacity: 0.35;
    transition: opacity 0.15s;
}
.modal-resize-handle:hover svg { opacity: 0.7; }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header h2 { font-size: 1rem; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); padding: 0.25rem; }
.modal-body, #modalBody { padding: 1rem; overflow-y: auto; flex: 1; min-height: 0; }

/* Assign list */
.assign-list { max-height: 400px; overflow-y: auto; margin-top: 0.75rem; }
.assign-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border);
    cursor: pointer; border-radius: 6px;
}
.assign-item:hover { background: var(--primary-bg); }
.assign-item.assigned { background: var(--success-bg); }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0a4b8c 0%, #1a6fc4 100%); }
.login-card { background: white; padding: 2.5rem; border-radius: 16px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); text-align: center; }
.login-logo { font-size: 3rem; margin-bottom: 0.5rem; }
.login-card h1 { font-size: 1.5rem; color: var(--primary); margin-bottom: 0.25rem; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
.login-card .form-group { text-align: left; }
.login-hint { margin-top: 1rem; font-size: 0.75rem; color: var(--text-secondary); }

.text-muted { color: var(--text-secondary); }
.text-mono { font-family: monospace; font-size: 0.8rem; background: var(--bg); padding: 0.75rem; border-radius: 6px; word-break: break-all; }

/* File preview */
.file-preview { margin-top: 0.5rem; }
.file-preview img { max-width: 100%; max-height: 300px; border-radius: 6px; border: 1px solid var(--border); }
.file-preview a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* Player photo */
.player-photo-section { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.player-photo { width: 90px; height: 110px; border-radius: 8px; object-fit: cover; border: 2px solid var(--border); background: var(--bg); }
.player-photo-placeholder { width: 90px; height: 110px; border-radius: 8px; border: 2px dashed var(--border); background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--text-secondary); }
.player-photo-actions { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.player-photo-name { font-size: 1.1rem; font-weight: 700; }
.player-photo-meta { font-size: 0.8rem; color: var(--text-secondary); }

/* Crop Modal */
.crop-container { max-height: 400px; overflow: hidden; background: #1a1a2e; border-radius: 6px; }
.crop-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.75rem; flex-wrap: wrap; }
.crop-hint { font-size: 0.75rem; color: var(--text-secondary); flex: 1; text-align: center; }

/* Info Button */
.info-btn { cursor: pointer; font-size: 0.85rem; vertical-align: middle; opacity: 0.7; }
.info-btn:hover { opacity: 1; }

/* Dokument Liste */
.dok-list { display: flex; flex-direction: column; gap: 3px; }
.dok-item { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; padding: 3px 6px; background: var(--bg); border-radius: 4px; }
.dok-item a { color: var(--primary); text-decoration: none; word-break: break-all; }
.dok-item a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 768px) {
    .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--primary); flex-direction: column; padding: 0.5rem; }
    .nav-links.open { display: flex; }
    .nav-user { display: none; }
    .nav-toggle { display: block; margin-left: auto; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2col { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .filter-form { flex-direction: column; }
    .page-header { flex-direction: column; }
}
