/* Reset und Basis-Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

/* Navigation */
.main-nav {
    background-color: #2c3e50;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.main-nav li {
    flex: 1;
    min-width: 150px;
}

.main-nav a {
    display: block;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s, color 0.3s;
    border-right: 1px solid #34495e;
}

.main-nav a:hover {
    background-color: #34495e;
    color: #fff;
}

.main-nav a.active {
    background-color: #3498db;
    color: #fff;
}

/* Main Content */
main {
    padding: 30px;
}

h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 3px solid #3498db;
    font-size: 24px;
}

h3 {
    color: #34495e;
    margin: 20px 0 15px;
    font-size: 18px;
}

h4 {
    color: #34495e;
    margin: 15px 0 10px;
    font-size: 16px;
}

/* Forms */
.form-section {
    background-color: #f8f9fa;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 12px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
}

.checkbox-group > div {
    margin: 5px 0;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
}

.checkbox-group label {
    display: inline;
    font-weight: normal;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.1s;
    text-decoration: none;
    display: inline-block;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-remove {
    background-color: #e74c3c;
    color: white;
    padding: 2px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-left: 10px;
}

.btn-remove:hover {
    background-color: #c0392b;
}

.form-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.form-actions .btn {
    margin-right: 10px;
}

/* Search Results */
.search-results {
    position: relative;
    background-color: white;
    border: 1px solid #ced4da;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
}

.search-result-item:hover {
    background-color: #e9ecef;
}

.no-results {
    padding: 10px;
    color: #6c757d;
    font-style: italic;
}

/* Selected Students */
.selected-students {
    margin-top: 15px;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 4px;
}

.selected-students ul {
    list-style: none;
    margin-top: 10px;
}

.selected-students li {
    padding: 8px;
    margin: 5px 0;
    background-color: white;
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.data-table thead {
    background-color: #2c3e50;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #34495e;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #dee2e6;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px;
}

.sortable:hover {
    background-color: #34495e;
}

.sort-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.sortable.sort-asc .sort-icon::after {
    content: "▲";
}

.sortable.sort-desc .sort-icon::after {
    content: "▼";
}

.text-center {
    text-align: center;
}

.project-link,
.student-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
}

.project-link:hover,
.student-link:hover {
    text-decoration: underline;
}

.students-cell {
    max-width: 300px;
    word-wrap: break-word;
}

/* Filter Section */
.filter-section {
    background-color: #f8f9fa;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.filter-section form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

/* Student Selection */
.student-selection {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.student-selection .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Student Header */
.student-header {
    display: flex;
    gap: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.student-info {
    flex: 1;
}

.student-info h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.student-info p {
    margin: 5px 0;
}

.student-note {
    flex: 1;
}

.student-note label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.student-note textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    resize: vertical;
}

/* Calculations */
.calculations,
.final-calculations,
.additional-data {
    background-color: #f8f9fa;
    padding: 20px;
    margin: 20px 0;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.calc-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.calc-row strong {
    min-width: 200px;
    color: #2c3e50;
}

.calc-row input {
    width: 150px;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.calc-row label {
    font-weight: 600;
    color: #495057;
}

hr {
    border: none;
    border-top: 2px solid #dee2e6;
    margin: 25px 0;
}

/* Info Box */
.info-box {
    background-color: #e7f3ff;
    border-left: 4px solid #3498db;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 4px;
}

.info-box h3 {
    margin-top: 0;
    color: #2c3e50;
}

.info-box ul {
    margin: 15px 0 0 20px;
}

.info-box li {
    margin: 8px 0;
}

.info-box code {
    background-color: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Messages */
.success-message {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.warning-message {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-style: italic;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .main-nav ul {
        flex-direction: column;
    }
    
    .main-nav li {
        width: 100%;
    }
    
    .main-nav a {
        border-right: none;
        border-bottom: 1px solid #34495e;
    }
    
    .student-header {
        flex-direction: column;
    }
    
    .filter-section form {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .calc-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .calc-row strong {
        min-width: auto;
    }
    
    .calc-row input {
        width: 100%;
    }
}

/* Scrollbar Styling */
.table-container::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-container::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
    background: #555;
}
