/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    background-attachment: fixed;
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

/* Sections */
section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

/* File Upload */
.file-upload {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.upload-btn {
    background-color: #27ae60;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.3s;
}

.upload-btn:hover {
    background-color: #229954;
}

#file-input {
    display: none;
}

.file-name {
    color: #7f8c8d;
    font-style: italic;
    font-size: 14px;
}

/* Student Stats */
.student-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-weight: bold;
    color: #2c3e50;
}

/* Students Container */
.students-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 10px;
}

.student-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f2f6;
}

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

.student-checkbox {
    margin-right: 10px;
    transform: scale(1.2);
}

.student-name {
    font-size: 14px;
    color: #2c3e50;
}

/* Controls */
.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.group-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-size-control label {
    font-weight: bold;
    color: #2c3e50;
}

#group-size {
    width: 80px;
    padding: 8px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-size: 14px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s;
}

.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-danger {
    background-color: #e74c3c;
    color: white;
}

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

/* Groups Section */
.groups-section {
    display: none;
}

.groups-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.groups-controls label {
    font-weight: bold;
    color: #2c3e50;
}

#select-count {
    width: 60px;
    padding: 6px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-size: 14px;
}

/* Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.group-card {
    background: white;
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    position: relative;
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.group-card.selected {
    border-color: #e74c3c;
    background-color: #fdf2f2;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.group-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.group-number {
    background-color: #3498db;
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: bold;
    font-size: 14px;
    margin-right: 10px;
}


.group-members {
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.8;
}

/* Group colors */
.group-card[data-group="1"] .group-number { background-color: #e74c3c; }
.group-card[data-group="2"] .group-number { background-color: #3498db; }
.group-card[data-group="3"] .group-number { background-color: #2ecc71; }
.group-card[data-group="4"] .group-number { background-color: #f39c12; }
.group-card[data-group="5"] .group-number { background-color: #9b59b6; }
.group-card[data-group="6"] .group-number { background-color: #1abc9c; }
.group-card[data-group="7"] .group-number { background-color: #e67e22; }
.group-card[data-group="8"] .group-number { background-color: #34495e; }

/* Status */
.status-section {
    text-align: center;
    padding: 15px;
}

.status {
    color: #7f8c8d;
    font-style: italic;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .groups-grid {
        grid-template-columns: 1fr;
    }
    
    .groups-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.group-card {
    animation: fadeIn 0.3s ease-out;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    width: 100%;
    margin-top: 0;
    overflow: hidden;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-brand h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ecf0f1;
}

.footer-brand p {
    color: #bdc3c7;
    font-size: 0.9rem;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-links a {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.footer-links a:hover {
    color: #3498db;
    transform: translateY(-2px);
}

.footer-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: #3498db;
    transition: width 0.3s ease;
}

.footer-links a:hover::after {
    width: 100%;
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    color: #bdc3c7;
    font-size: 0.85rem;
    margin: 0;
}

/* History Section */
.history-section {
    display: none;
}

.history-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.history-entry {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.history-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.history-date {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.history-hash {
    font-size: 0.75rem;
    color: #adb5bd;
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
}

.history-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-group {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
}

.history-group-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.history-group-number {
    background-color: #3498db;
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
    margin-right: 10px;
}

.history-group-members {
    color: #495057;
    font-size: 13px;
    line-height: 1.4;
}

.history-empty {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

/* History group colors */
.history-group[data-group="1"] .history-group-number { background-color: #e74c3c; }
.history-group[data-group="2"] .history-group-number { background-color: #3498db; }
.history-group[data-group="3"] .history-group-number { background-color: #2ecc71; }
.history-group[data-group="4"] .history-group-number { background-color: #f39c12; }
.history-group[data-group="5"] .history-group-number { background-color: #9b59b6; }
.history-group[data-group="6"] .history-group-number { background-color: #1abc9c; }
.history-group[data-group="7"] .history-group-number { background-color: #e67e22; }
.history-group[data-group="8"] .history-group-number { background-color: #34495e; }

/* Responsive Footer */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
    
    .history-grid {
        grid-template-columns: 1fr;
    }
}
