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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Admin mode container - wider */
.container.admin-mode {
    max-width: 1100px;
}

/* Hide admin pages until role is verified - prevents flash of content */
body:has(.container.admin-mode) {
    opacity: 0;
    transition: opacity 0.15s ease;
}

body.verified:has(.container.admin-mode) {
    opacity: 1;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header h2 {
    font-size: 1.2em;
    font-weight: 300;
    opacity: 0.9;
}

nav {
    margin-top: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.3);
}

main {
    padding: 40px;
}

.card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.card h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

input[type="text"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 200px;
}

small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9em;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid #f5c6cb;
}

.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#resultsContent {
    margin: 20px 0;
}

.result-summary {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.result-summary h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.result-summary .grade {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
    text-align: center;
    margin: 20px 0;
}

.result-summary .marks {
    text-align: center;
    font-size: 1.5em;
    color: #555;
    margin: 10px 0;
}

.result-summary .percentage {
    text-align: center;
    font-size: 1.2em;
    color: #666;
}

.section-breakdown {
    margin-top: 20px;
}

.section-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.section-item h5 {
    color: #667eea;
    margin-bottom: 8px;
}

.feedback-section {
    margin-top: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.feedback-section h5 {
    color: #667eea;
    margin-bottom: 15px;
}

.feedback-section ul {
    list-style: none;
    padding-left: 0;
}

.feedback-section li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.feedback-section li:last-child {
    border-bottom: none;
}

#papersList {
    margin-top: 20px;
}

.paper-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.paper-item h5 {
    color: #667eea;
    margin-bottom: 5px;
}

.paper-item p {
    color: #666;
    font-size: 0.9em;
    margin: 5px 0;
}

.paper-item h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.paper-item .btn {
    font-size: 0.9em;
    padding: 8px 16px;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    border-top: 1px solid #ddd;
}

#pdfDownload {
    margin-top: 20px;
    text-align: center;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
        max-width: 100%;
    }

    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    header h2 {
        font-size: 1em;
    }

    nav {
        flex-direction: column;
        gap: 10px;
    }

    nav a {
        display: block;
        text-align: center;
    }

    main {
        padding: 15px;
    }

    .card {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 0;
    }

    .card h3 {
        font-size: 1.2em;
    }

    input[type="text"],
    input[type="file"],
    select,
    textarea {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }

    textarea {
        min-height: 150px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
    }

    .result-summary .grade {
        font-size: 2.5em;
    }

    .result-summary .marks {
        font-size: 1.2em;
    }

    footer {
        padding: 15px;
        font-size: 0.9em;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    header h2 {
        font-size: 0.9em;
    }

    main {
        padding: 10px;
    }

    .card {
        padding: 12px;
    }

    .result-summary .grade {
        font-size: 2em;
    }
}