@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    margin: 0;
    padding: 20px;
    min-height: 100dvh; /* Dynamic viewport height */
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    max-width: 900px;
    width: 100%;
    margin: auto;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.container:hover {
    transform: translateY(-5px);
}

h1 {
    text-align: center;
    color: #1e3a8a;
    font-size: 30px;
    font-weight: 600;
    margin-bottom: 10px;
}

h2 {
    text-align: center;
    color: #4b5563;
    font-size: 25px;
    font-weight: 500;
    margin-bottom: 30px;
}

.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
}

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

label {
    display: block;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 20px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
    background: #2563eb;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 500;
    transition: background 0.3s ease, transform 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

button:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-2px);
}

button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

#clear-button {
    background: #f97316;
}

#clear-button:hover:not(:disabled) {
    background: #ea580c;
}

.error-message {
    color: #dc2626;
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
}

.wait-message {
    color: #2563eb;
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #2563eb;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-left: 5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-text {
    color: #dc2626;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.mark.invalid {
    background-color: #dc2626 !important;
    color: white; /* Improve text contrast on red background */
}

#marks-form {
    margin-bottom: 20px;
    padding-right: 10px;
    padding-bottom: 60px; /* Extra space for keyboard */
}

.button-group {
    display: flex;
    gap: 10px;
}

#student-list .row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
    transition: background 0.3s ease;
}

#student-list .row:hover {
    background: #eff6ff;
}

#student-list .name {
    flex: 1;
    font-size: 20px;
    color: #1f2937;
}

#student-list .mark {
    width: 80px;
    text-align: center;
}

#status-message {
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    margin-top: 15px;
    color: #16a34a;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
        align-items: flex-start;
    }

    .container {
        padding: 20px;
        max-width: 100%;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 18px;
    }

    button {
        padding: 10px;
    }

    #marks-form {
        padding-bottom: 100px; /* More space for mobile keyboard */
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }
}