:root {
    --dsp-gold: #cfb668;
    --dsp-purple: #3e2b56;
    --bg-gray: #f4f4f9;
    --white: #ffffff;
    --text-color: #333;
    --danger: #d9534f;
    --border-color: #ddd;
    --success: #5cb85c;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: var(--bg-gray);
    color: var(--text-color);
}

/* NAVIGATION */
nav {
    background-color: var(--dsp-purple);
    color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo { font-weight: bold; font-size: 1.2rem; color: var(--dsp-gold); }

button {
    cursor: pointer;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.nav-links button {
    background: transparent;
    color: var(--white);
    border: 1px solid var(--dsp-gold);
    margin-left: 10px;
}
.nav-links button:hover { background: var(--dsp-gold); color: var(--dsp-purple); }

/* LAYOUT */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.section { display: none; }
.active { display: block; animation: fadeIn 0.4s; }
.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* CARDS & CONTAINERS */
.card, .question-block, .rubric-box, .stats-box {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

/* BUTTONS */
.primary-btn {
    background-color: var(--dsp-purple);
    color: var(--white);
    font-size: 1rem;
    padding: 10px 20px;
}
.primary-btn:hover { opacity: 0.9; }

.warning-btn {
    background-color: var(--danger);
    color: var(--white);
}

.secondary-btn {
    background-color: #555;
    color: white;
}

.add-btn {
    background-color: var(--dsp-purple);
    color: white;
    padding: 6px 12px;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    font-size: 1.2rem;
    line-height: 1;
}
.delete-btn:hover { color: #a94442; }

/* INPUTS */
input[type="text"], input[type="password"], input[type="file"], select, textarea {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
    font-family: inherit;
}

/* GRADER INTERFACE */
.question-block h4 { margin-top: 0; color: var(--dsp-purple); }
.question-prompt {
    color: #333;
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.5;
}

.response-text {
    background: #fafafa; 
    padding: 15px; 
    border-left: 4px solid var(--dsp-gold); 
    font-style: italic;
    margin-bottom: 15px;
    line-height: 1.5;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
    font-weight: bold;
}

.radios label {
    margin-right: 15px;
    cursor: pointer;
    font-weight: normal;
}
.radios input { margin-right: 5px; }

/* Rubric Section */
.rubric-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.rubric-header {
    font-weight: bold;
    color: var(--dsp-purple);
    display: block;
    margin-bottom: 10px;
}

.rubric-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rubric-item {
    background: #f9f9fc;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 15px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.rubric-item:hover {
    border-color: var(--dsp-gold);
    background: #fff;
}

.rubric-item:has(input:checked) {
    border-color: var(--dsp-purple);
    background: linear-gradient(135deg, #f5f0fa, #fff);
    box-shadow: 0 2px 6px rgba(62, 43, 86, 0.15);
}

.rubric-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    width: 100%;
}

.rubric-label input[type="radio"] {
    margin: 0;
    margin-top: 3px;
    width: auto;
    flex-shrink: 0;
}

.score-number {
    background: var(--dsp-purple);
    color: var(--white);
    font-weight: bold;
    font-size: 1rem;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rubric-item:has(input:checked) .score-number {
    background: var(--dsp-gold);
    color: var(--dsp-purple);
}

.score-desc {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.4;
    flex: 1;
}

/* Hidden Comment Box Animation */
.specific-comment-box {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    animation: fadeIn 0.3s;
}

/* Group Info in Grader Welcome */
.group-info {
    background: linear-gradient(135deg, var(--dsp-purple), #5a3d7a);
    color: var(--white);
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 15px;
}
.group-info strong {
    color: var(--dsp-gold);
}

/* ADMIN DASHBOARD */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.grader-list, .conflict-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid #eee;
}
.grader-list li, .conflict-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f4f4f4;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.grader-list li span, .conflict-list li strong { 
    font-weight: bold; 
    color: var(--dsp-purple); 
}
.empty-list { color: #888; font-style: italic; }
.small-note { font-size: 0.8rem; color: #666; margin-top: 5px; }

/* GROUP CARDS */
.group-card {
    background: #f9f9fc;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}
.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.group-header strong {
    color: var(--dsp-purple);
}
.group-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.member-tag {
    background: var(--dsp-purple);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.member-tag button {
    background: none;
    border: none;
    color: var(--dsp-gold);
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}
.member-tag button:hover { color: #fff; }

/* Assign Grader Section */
.assign-grader-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.assign-grader-section h4 {
    margin-bottom: 10px;
    color: var(--dsp-purple);
}

/* LOADING OVERLAY */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 6px solid #e0e0e0;
    border-top: 6px solid var(--dsp-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* MODAL OVERLAY */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

/* DISTRIBUTION PREVIEW MODAL */
.distribute-modal-content {
    background: var(--white);
    width: 90%;
    max-width: 550px;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s;
    max-height: 80vh;
    overflow-y: auto;
}
.distribute-modal-content h3 {
    color: var(--dsp-purple);
    margin-top: 0;
    font-size: 1.4rem;
    border-bottom: 2px solid var(--dsp-gold);
    padding-bottom: 10px;
}
.distribute-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.distribute-modal-buttons button {
    flex: 1;
    padding: 12px 20px;
}

.preview-summary, .preview-groups, .preview-conflicts {
    margin-bottom: 15px;
    padding: 12px;
    background: #f9f9fc;
    border-radius: 6px;
}
.preview-summary ul, .preview-groups ul {
    margin: 8px 0 0 20px;
    padding: 0;
}
.preview-summary li, .preview-groups li {
    padding: 3px 0;
}

.preview-conflicts {
    background: #fff8e5;
    border-left: 4px solid #ffc107;
}

.conflict-preview-list {
    margin: 10px 0 10px 20px;
    padding: 0;
    max-height: 150px;
    overflow-y: auto;
}
.conflict-preview-list li {
    padding: 4px 0;
    font-size: 0.9rem;
}
.conflict-grader {
    color: var(--dsp-purple);
    font-weight: bold;
}
.conflict-recruit {
    color: var(--danger);
    font-weight: bold;
}
.conflict-note {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-top: 10px;
}
.no-conflicts {
    color: var(--success);
    font-weight: bold;
    padding: 10px;
    background: #f0fff0;
    border-radius: 6px;
}
.warning-note {
    color: var(--danger);
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: #fff0f0;
    border-radius: 6px;
}

/* CONFLICT WARNING MODAL */
.conflict-modal-content {
    background: var(--white);
    width: 90%;
    max-width: 450px;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s;
}
.conflict-modal-content h3 {
    color: var(--danger);
    margin-top: 0;
    font-size: 1.5rem;
}
.conflict-modal-content p {
    margin: 15px 0;
    line-height: 1.5;
}
.conflict-modal-content strong {
    color: var(--dsp-purple);
}
.conflict-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}
.conflict-modal-buttons button {
    flex: 1;
    padding: 12px 20px;
}

/* Stats Box */
.stats-box h4 {
    margin-top: 15px;
    margin-bottom: 8px;
    color: var(--dsp-purple);
}
.stats-box ul {
    margin: 0;
    padding-left: 20px;
}
.stats-box li {
    padding: 4px 0;
}

/* Grader Assignments Grid */
.grader-assignments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.grader-assignment-card {
    background: #f9f9fc;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.grader-assignment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.grader-assignment-header strong {
    color: var(--dsp-purple);
    font-size: 1rem;
}

.grader-group-badge {
    background: var(--dsp-gold);
    color: var(--dsp-purple);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.grader-progress-bar {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #555;
}

.recruit-ids-list small {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.recruit-ids {
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--dsp-purple);
    max-height: 100px;
    overflow-y: auto;
    border: 1px solid #eee;
    line-height: 1.6;
}

/* Progress Bar */
.progress-bar {
    background: var(--dsp-purple);
    color: var(--white);
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: bold;
}
.progress-bar span {
    color: var(--dsp-gold);
}
