* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #e7f3ff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
    --text-light: #666;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --border-radius: 5px;
}

/* ===== BODY & GENERAL ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--light-color);
    line-height: 1.6;
}

html, body, #root {
    height: 100%;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    margin: 20px 0 10px 0;
    color: var(--dark-color);
    font-weight: 600;
}

h1 { font-size: 2.5em; }
h2 { font-size: 2em; }
h3 { font-size: 1.5em; }
h4 { font-size: 1.3em; }
h5 { font-size: 1.1em; }
h6 { font-size: 1em; }

p {
    margin: 10px 0;
    color: var(--text-light);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== LAYOUT STRUCTURE ===== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 0;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    margin: 0;
    color: white;
    padding: 0 40px;
    font-size: 2em;
}

header nav {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 10px 40px;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

header nav a {
    color: white;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

header nav a:hover {
    opacity: 0.8;
    text-decoration: none;
}

main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    min-height: calc(100vh - 200px);
}

footer {
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 50px;
}

footer p {
    margin: 5px 0;
    color: white;
}

/* ===== CONTAINERS & CARDS ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 15px 0;
    box-shadow: var(--box-shadow);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.card-header h3 {
    margin: 0;
}

/* ===== FORMS ===== */
form {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 20px 0;
}

.form-group {
    margin: 20px 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== BUTTONS ===== */
button,
input[type="submit"],
.btn {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

button:active,
input[type="submit"]:active,
.btn:active {
    transform: translateY(0);
}

/* Button variants */
.btn-success {
    background-color: var(--success-color);
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-warning {
    background-color: var(--warning-color);
    color: #333;
}

.btn-warning:hover {
    background-color: #e0a800;
    color: #333;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

button[type="button"] {
    margin-left: 10px;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    margin: 20px 0;
}

table thead {
    background-color: var(--primary-color);
    color: white;
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

table tbody tr:hover {
    background-color: var(--primary-light);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== LISTS ===== */
ul, ol {
    margin: 15px 0;
    padding-left: 25px;
}

ul li, ol li {
    margin: 8px 0;
    color: var(--text-light);
}

/* ===== ALERTS & MESSAGES ===== */
.alert {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: var(--border-radius);
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert.error,
.alert.danger {
    background-color: #f8d7da;
    border-left-color: var(--danger-color);
    color: #721c24;
}

.alert.success {
    background-color: #d4edda;
    border-left-color: var(--success-color);
    color: #155724;
}

.alert.warning {
    background-color: #fff3cd;
    border-left-color: var(--warning-color);
    color: #856404;
}

.alert.info {
    background-color: #d1ecf1;
    border-left-color: var(--info-color);
    color: #0c5460;
}

/* ===== FLEX & GRID UTILITIES ===== */
.flex {
    display: flex;
    gap: 20px;
}

.flex-column {
    flex-direction: column;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

.flex-between {
    justify-content: space-between;
    align-items: center;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 30px;
    margin: 30px 0;
}

.sidebar {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li {
    margin: 10px 0;
}

.sidebar ul li a {
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.sidebar ul li a:hover {
    background-color: var(--primary-light);
    text-decoration: none;
}

.sidebar ul li a.active {
    background-color: var(--primary-color);
    color: white;
}

.content {
    flex: 1;
}

/* ===== AUTHENTICATION PAGES ===== */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.auth-container h2 {
    text-align: center;
    margin-top: 0;
    color: var(--primary-color);
}

/* ===== MESSAGING ===== */
.messages-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    height: 300px;
    overflow-y: auto;
    background-color: #f9f9f9;
    margin: 15px 0;
}

.message {
    margin: 10px 0;
    padding: 10px;
    background: white;
    border-left: 3px solid var(--primary-color);
    border-radius: 3px;
}

.message strong {
    color: var(--primary-color);
}

/* ===== FILE MANAGEMENT ===== */
.file-list {
    list-style: none;
    padding: 0;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin: 10px 0;
    transition: background-color 0.3s ease;
}

.file-item:hover {
    background-color: var(--primary-light);
}

.file-name {
    flex: 1;
    font-weight: 600;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.file-actions a {
    padding: 6px 12px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 3px;
    font-size: 13px;
    transition: background-color 0.3s ease;
}

.file-actions a:hover {
    background-color: var(--primary-dark);
    text-decoration: none;
}

/* ===== BADGES & TAGS ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.success {
    background-color: var(--success-color);
}

.badge.danger {
    background-color: var(--danger-color);
}

.badge.warning {
    background-color: var(--warning-color);
    color: #333;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5em;
        padding: 0 20px;
    }
    
    header nav {
        padding: 10px 20px;
        gap: 15px;
    }
    
    main {
        padding: 0 10px;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar {
        position: static;
    }
    
    .flex {
        flex-direction: column;
    }
    
    form {
        padding: 15px;
    }
    
    .auth-container {
        margin: 50px auto;
    }
    
    table {
        font-size: 14px;
    }
    
    table th,
    table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.8em; }
    h2 { font-size: 1.5em; }
    h3 { font-size: 1.2em; }
    
    header h1 {
        font-size: 1.3em;
    }
    
    header nav {
        flex-direction: column;
        gap: 5px;
    }
    
    button,
    input[type="submit"],
    .btn {
        width: 100%;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .file-actions {
        width: 100%;
        margin-top: 10px;
    }
    
    .file-actions a {
        flex: 1;
        text-align: center;
    }
}

/* ===== UTILITIES ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

.hidden {
    display: none;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ===== PRINT STYLES ===== */
@media print {
    header, footer, .no-print {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .card, form, table {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* ===== DASHBOARD PROFESSOR PAGES ===== */
.dashboard-nav {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 20px 0;
}

.dashboard-nav h1 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
}

.dashboard-nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.dashboard-nav ul li {
    margin: 0;
}

.dashboard-nav ul li a {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-decoration: none;
}

.dashboard-nav ul li a:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    text-decoration: none;
}

/* Upload Page Styles */
.upload-container {
    max-width: 600px;
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 20px 0;
}

.upload-container h2 {
    color: var(--primary-color);
    margin-top: 0;
}

.upload-info {
    background-color: var(--primary-light);
    padding: 15px;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    margin: 15px 0;
    color: #0056b3;
    font-size: 14px;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    display: block;
    padding: 15px;
    background-color: var(--primary-light);
    border: 2px dashed var(--primary-color);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--primary-color);
    font-weight: 600;
}

.file-input-label:hover {
    background-color: #d4e7ff;
    border-color: var(--primary-dark);
}

.file-input-label.drag-over {
    background-color: #b3d9ff;
    border-color: var(--primary-dark);
}

/* My Files Page */
.files-container {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 20px 0;
}

.files-container h2 {
    color: var(--primary-color);
    margin-top: 0;
}

.files-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.file-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.file-card:hover {
    box-shadow: var(--box-shadow);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.file-card-icon {
    font-size: 3em;
    text-align: center;
    margin-bottom: 15px;
}

.file-card-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
    word-break: break-word;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.file-card-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.file-card-actions a,
.file-card-actions button {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
    text-align: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.file-card-actions .btn-download {
    background-color: var(--success-color);
    color: white;
    border: none;
    cursor: pointer;
}

.file-card-actions .btn-download:hover {
    background-color: #218838;
    text-decoration: none;
}

.file-card-actions .btn-delete {
    background-color: var(--danger-color);
    color: white;
    border: none;
    cursor: pointer;
}

.file-card-actions .btn-delete:hover {
    background-color: #c82333;
    text-decoration: none;
}

/* Messages Page */
.messaging-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    margin: 20px 0;
}

.students-list {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.students-list h3 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.students-list ul {
    list-style: none;
    padding: 0;
}

.students-list ul li {
    margin: 0;
}

.students-list ul li a {
    display: block;
    padding: 10px 12px;
    margin: 5px 0;
    border-radius: 4px;
    color: var(--primary-color);
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.students-list ul li a:hover {
    background-color: var(--primary-light);
    border-left-color: var(--primary-color);
    text-decoration: none;
}

.students-list ul li a.active {
    background-color: var(--primary-color);
    color: white;
    border-left-color: var(--primary-dark);
}

.messages-box {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
}

.messages-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.messages-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.messages-display {
    border: 1px solid var(--border-color);
    padding: 15px;
    height: 400px;
    overflow-y: auto;
    background-color: #f9f9f9;
    margin-bottom: 20px;
    border-radius: 4px;
}

.message-item {
    margin: 10px 0;
    padding: 12px;
    background: white;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    animation: slideIn 0.3s ease;
}

.message-item.sent {
    border-left-color: var(--success-color);
    background-color: #f0f8f5;
    margin-left: 40px;
}

.message-item.received {
    border-left-color: var(--primary-color);
    margin-right: 40px;
}

.message-sender {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 12px;
    margin-bottom: 5px;
}

.message-body {
    color: var(--text-color);
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 5px;
}

.message-form {
    display: flex;
    flex-direction: column;
}

.message-form textarea {
    min-height: 80px;
    margin-bottom: 10px;
    padding: 10px;
}

.message-form-actions {
    display: flex;
    gap: 10px;
}

.message-form-actions button {
    flex: 1;
}

.no-student-selected {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-student-selected p {
    font-size: 18px;
    margin: 0;
}

/* Responsive Dashboard */
@media (max-width: 1024px) {
    .messaging-container {
        grid-template-columns: 1fr;
    }
    
    .students-list {
        position: static;
    }
}

@media (max-width: 768px) {
    .dashboard-nav ul {
        flex-direction: column;
    }
    
    .dashboard-nav ul li a {
        display: block;
        width: 100%;
        text-align: center;
    }
    
    .file-grid {
        grid-template-columns: 1fr;
    }
    
    .messaging-container {
        grid-template-columns: 1fr;
    }
    
    .message-item.sent,
    .message-item.received {
        margin-left: 0;
        margin-right: 0;
    }
}
