:root {
    --primary: #2563eb;
    --accent: #7c3aed;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1f2937;
    --text-muted: #64748b;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==== Nav ==== */
nav.topnav {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: sticky; top: 0; z-index: 100;
}
nav.topnav .container {
    max-width: 1200px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
    height: 64px; flex-wrap: wrap;
}
nav.topnav .brand { font-weight: 700; color: var(--primary); font-size: 1.1rem; }
nav.topnav ul { list-style: none; display: flex; gap: 0.4rem; flex-wrap: wrap; }
nav.topnav a {
    padding: 0.45rem 0.9rem; border-radius: 6px; color: var(--text-muted);
    font-size: 0.92rem; font-weight: 500;
    transition: background 0.15s ease;
}
nav.topnav a:hover { background: #eff6ff; color: var(--primary); text-decoration: none; }
nav.topnav a.active { background: var(--primary); color: white; }

main { max-width: 1000px; margin: 2rem auto; padding: 0 1.25rem; }

h1 { font-size: 1.85rem; color: var(--primary); margin-bottom: 1.25rem; }
h2 { font-size: 1.4rem; color: var(--text); margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1.1rem; color: var(--text); margin: 1rem 0 0.5rem; }

p { margin-bottom: 0.75rem; }

/* ==== Cards ==== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-bottom: 1.25rem;
}
.card-highlight {
    background: linear-gradient(135deg, #eff6ff, #f9f5ff);
    border-color: var(--primary);
}
.card-muted { background: #f8fafc; }

/* ==== Forms ==== */
form label {
    display: block;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
    color: var(--text);
}
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="datetime-local"],
form input[type="number"],
form select,
form textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form input:focus, form textarea:focus, form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
form textarea { min-height: 100px; resize: vertical; }
form small.hint {
    display: block; color: var(--text-muted); font-size: 0.85rem;
    margin-top: -0.6rem; margin-bottom: 0.9rem;
}

button, .btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    text-decoration: none;
}
button:hover, .btn:hover { background: #1d4ed8; transform: translateY(-1px); text-decoration: none; }
.btn-secondary { background: #64748b; }
.btn-secondary:hover { background: #475569; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #047857; }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* ==== Flash messages ==== */
.flash {
    padding: 0.85rem 1.1rem; border-radius: 8px; margin-bottom: 1rem;
    border-left: 4px solid;
}
.flash-info    { background: #eff6ff; color: #1e40af; border-left-color: var(--primary); }
.flash-success { background: #ecfdf5; color: #065f46; border-left-color: var(--success); }
.flash-error   { background: #fef2f2; color: #991b1b; border-left-color: var(--danger); }

/* ==== Tables ==== */
table.data {
    width: 100%; border-collapse: collapse; background: white;
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
table.data th {
    background: #f1f5f9;
    padding: 0.75rem 1rem; text-align: left;
    font-weight: 600; font-size: 0.9rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
table.data td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.93rem;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover { background: #f8fafc; }

/* ==== Badges ==== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warn    { background: #fef3c7; color: #78350f; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* ==== Assignment listing ==== */
.assignment-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    background: white;
    margin-bottom: 0.8rem;
    display: flex; justify-content: space-between; align-items: center;
    transition: border-color 0.15s ease;
    gap: 1rem;
    flex-wrap: wrap;
}
.assignment-card:hover { border-color: var(--primary); }
.assignment-card .title { font-weight: 600; font-size: 1rem; margin-bottom: 0.25rem; }
.assignment-card .meta  { color: var(--text-muted); font-size: 0.88rem; }

/* ==== Utility ==== */
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.88rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

@media (max-width: 640px) {
    nav.topnav ul { width: 100%; justify-content: center; }
    main { padding: 0 0.85rem; margin-top: 1rem; }
    h1 { font-size: 1.45rem; }
    .assignment-card { flex-direction: column; align-items: flex-start; }
}
