/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

a {
    text-decoration: none;
    color: #3498db;
}

ul {
    list-style-type: none;
}

/* Header */
.site-header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Layout */
.container {
    display: flex;
    min-height: calc(100vh - 60px); /* Subtract header height */
}

.sidebar {
    width: 250px;
    background-color: #fff;
    border-right: 1px solid #e1e4e8;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
}

.content {
    flex: 1;
    padding: 2rem;
    margin-left: 250px;
}

/* Navigation */
.main-nav {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.nav-header {
    padding: 1rem;
    border-bottom: 1px solid #e1e4e8;
}

.nav-header h2 {
    font-size: 1.2rem;
    color: #2c3e50;
}

.class-list {
    flex: 1;
    overflow-y: auto;
}

.class-item {
    border-bottom: 1px solid #e1e4e8;
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.class-header:hover {
    background-color: #f1f5f9;
}

.class-name {
    font-weight: 500;
}

.toggle-icon {
    font-size: 1.2rem;
}

.unit-list {
    display: none;
    background-color: #f8f9fb;
}

.unit-list.expanded {
    display: block;
}

.unit-item {
    padding: 0.5rem 1rem 0.5rem 2rem;
    transition: background-color 0.2s;
}

.unit-item:hover {
    background-color: #e9ecef;
}

.unit-item.active {
    background-color: #e3f2fd;
    border-left: 3px solid #3498db;
}

.unit-item a {
    display: block;
    color: #546e7a;
}

.unit-item.active a {
    color: #3498db;
    font-weight: 500;
}

.nav-footer {
    padding: 1rem;
    border-top: 1px solid #e1e4e8;
    text-align: center;
}

.admin-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #f1f5f9;
    color: #546e7a;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.admin-link:hover {
    background-color: #e3f2fd;
    color: #3498db;
}

/* Activities */
.activities-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(300px, 500px));
    gap: 1.5rem;
    margin-top: 1.5rem;
    justify-content: start;
}

.activity-card {
    width: 500px;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.activity-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.activity-card h3 {
    padding: 1rem;
    background-color: #f8f9fb;
    border-bottom: 1px solid #e1e4e8;
    font-size: 1rem;
    color: #2c3e50;
}

.activity-frame {
    height: 320px;
}

.activity-frame iframe {
    border: none;
    height: 100%;
    width: 100%;
}

/* Unit Files */
.unit-files {
    margin-bottom: 1.5rem;
}

#show-files-btn {
    display: flex;
    align-items: center;
    background-color: #ecf0f1;
    color: #2c3e50;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

#show-files-btn:hover {
    background-color: #d5dbdb;
}

.file-icon {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

.file-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #3498db;
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* Files Modal */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.file-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background-color: #f8f9fb;
    border-radius: 8px;
    transition: all 0.2s;
    color: #2c3e50;
    text-decoration: none;
    border: 1px solid #e1e4e8;
}

.file-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: #e3f2fd;
    border-color: #3498db;
}

.file-card .file-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.file-name {
    font-weight: 500;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.file-meta {
    display: flex;
    font-size: 0.8rem;
    color: #7f8c8d;
    gap: 0.5rem;
}

.file-type {
    font-weight: 600;
}

/* Messages */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 15px;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

/* Responsive adjustments */
@media (max-width: 1600px) {
    .activities-grid {
        grid-template-columns: repeat(2, 500px);
    }
}

@media (max-width: 1100px) {
    .activities-grid {
        grid-template-columns: 500px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        height: auto;
    }
    
    .content {
        margin-left: 0;
    }
    
    .activities-grid {
        grid-template-columns: 1fr;
        justify-content: center;
    }
    
    .activity-card {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }
}