/* Global styles for the public frontend. */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

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

/* Body layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links a {
    margin-left: 1.5rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-full {
    width: 100%;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.feature-card h3 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.login-help {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Dashboard */
.dashboard h2 {
    margin-bottom: 0.5rem;
}

.role-badge {
    display: inline-block;
    background: #dbeafe;
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.dash-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.dash-card h3 {
    margin-bottom: 0.5rem;
}

.dash-card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Error container */
.error-container {
    text-align: center;
    padding: 4rem 1rem;
}

.error-container h2 {
    color: var(--danger);
    margin-bottom: 1rem;
}

.error-container p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Management Page */
.section-card {
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.help-text {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.csv-upload {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.file-input {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.status-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.status-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--success);
}

.status-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
}

.status-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.assignment-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.select-input {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    min-width: 200px;
}

.student-list {
    margin-top: 1rem;
}

.select-all-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.student-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.student-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.student-info {
    display: flex;
    flex-direction: column;
}

.student-email {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.student-subjects {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.subject-tag {
    background: #dbeafe;
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.no-subjects {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 0;
}

.loading {
    color: var(--text-muted);
}

.subject-card {
    border-left: 4px solid var(--primary);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

/* Inline info links in descriptions */
.info-link {
    display: inline;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 600;
    text-decoration: underline dotted;
    cursor: pointer;
    position: relative;
}

.info-link:hover,
.info-link:focus {
    color: var(--primary-dark);
}

.info-link-dialog {
    margin: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    max-width: 840px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.info-link-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
}

.info-link-dialog-content {
    padding: 1.5rem;
}

.info-link-dialog-text {
    margin: 0 0 1.25rem 0;
    line-height: 1.6;
    white-space: pre-wrap;
}

.info-link-dialog-close {
    float: right;
}

/* Consistent spacing below section titles */
.dashboard h3 {
    margin-bottom: 1.5rem;
}

.card h3 {
    margin-bottom: 1.5rem;
}

.card-header h3 {
    margin-bottom: 0;
}
