:root {
    --primary-color: #2ecc71;
    --primary-hover: #27ae60;
    --background: #f4f6f5;
    --text-color: #333;
    --border-color: #ddd;
    --visual-color: #2196f3;
    --hands-on-color: #ff9800;
    --reading-color: #4caf50;
    --border-radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Body and layout */
body {
    font-family: "Inter", Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--background);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow-y: auto;
    flex-direction: column;
}

.header {
    background: white;
    padding: 25px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.lesson-header {
    background: white;
    padding: 25px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

h1 {
    text-align: center;
    color: var(--text-color);
    font-size: 28px;
    margin-bottom: 30px;
    border-bottom: 3px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 8px;
}

.topiclist-container h1,
.topicdetail-container h1,
.lessondetail-container h1 {
    margin: 0 0 10px;
    font-size: 28px;
    color: var(--text-color);
}

.topicdetail-container p,
.lessondetail-container p {
    margin: 5px 0;
    font-size: 16px;
    color: var(--subtext-color);
}

body.topic-detail-container-body .content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: 12px;
}

a {
    color: inherit;
    text-decoration: none;
}


.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 50vh;
    color: #444;
    font-size: 1.2rem;
    font-weight: 500;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #ccc;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.topic-status-pending,
.topic-status-failed {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: #fff3e0;
    border-radius: 6px;
    font-size: 13px;
    color: #e65100;
}

.topic-status-success {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--primary-hover);
}

.generating-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #ff9800;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-text,
.status-text {
    font-weight: 500;
}


/* Homepage */

.homepage-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.hero-section {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    max-width: 800px;
    width: 100%;
}

.hero-section h1 {
    font-size: 48px;
    color: #333;
    margin: 0 0 20px;
    font-weight: 700;
}

.hero-description {
    font-size: 20px;
    color: #666;
    line-height: 1.6;
    margin: 20px 0 50px;
}

.features-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 50px;
}

.feature-item {
    text-align: center;
    flex: 1;
    max-width: 200px;
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.feature-item p {
    font-size: 16px;
    color: #666;
    margin: 0;
    font-weight: 500;
}


/* Containers */

.login-container,
.signup-container,
.profile-settings-container {
    background: rgba(255, 255, 255, 0.95);
    width: 100%;
    min-width: 400px;
    margin: auto;
    padding: 40px 35px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.login-container:hover,
.signup-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.assessment-container {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 30px 40px;
    margin: 20px auto;
}

.profile-container {
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin: 40px auto;
    gap: 30px;
    padding: 0 20px;
}

.lessondetail-container,
.topiclist-container,
.topicdetail-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Sections */

.sidebar {
    flex: 1;
    max-width: 320px;
}

.profile-section {
    background: white;
    padding: 25px 30px;
    margin-bottom: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.profile-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.main-content {
    flex: 2;
}

.content-section {
    background: white;
    padding: 25px 30px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 5px solid;
}

.visual-section {
    border-left-color: var(--visual-color);
}

.hands-on-section {
    border-left-color: var(--hands-on-color);
}

.reading-section {
    border-left-color: var(--reading-color);
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.section-icon {
    margin-right: 10px;
    font-size: 24px;
}

.progress-bar {
    width: 100%;
    background: #eee;
    border-radius: 8px;
    height: 10px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: var(--width);
    transition: width 0.3s ease;
}

.content-text {
    line-height: 1.8;
    color: var(--text-color);
    /* white-space: pre-line; */
}

.dominant-badge {
    background: var(--primary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 10px;
}


/* Heading */
.login-container h1,
.signup-container h1 {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 25px;
    font-size: 28px;
}

.profile-container h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.profile-container p {
    margin: 8px 0;
    line-height: 1.6;
}

.profile-container strong {
    color: var(--primary-hover);
}

/* Modals */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.modal p {
    margin-bottom: 20px;
}


/* Forms groups */

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

form p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

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

.form-group input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}


label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}



input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-group input[type="password"]:hover+.help,
.form-group input[type="password"]:focus+.help {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    /* animate down into place */
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
    outline: none;
}


.username-feedback {
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

.username-feedback.available {
    color: var(--primary-hover);
    display: block;
}

.username-feedback.taken {
    color: #e74c3c;
    display: block;
}



/* Lesson card and topic */

.topic-card {
    background: white;
    padding: 20px 25px;
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: block;
}


.topic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.topic-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.topic-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}


.topic-number {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

.lesson-card {
    background: white;
    padding: 20px 25px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.lesson-card.completed,
.topic-card.completed {
    background: rgba(144, 238, 144, 0.4);

    border: 1px solid rgba(60, 179, 113, 0.6);

}

.lesson-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.lesson-number {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
}

.lesson-title {
    font-size: 18px;
    font-weight: 600;
    margin: 8px 0;
}

.lesson-duration {
    font-size: 14px;
    color: var(--subtext-color);
}

/* Error messages */
.errorlist {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    list-style: none;
    padding: 10px 15px;
    margin: 0 0 20px 0;
    font-size: 14px;
    text-align: center;
}


.alert {
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.alert-success,
.alert-info {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #2ecc71;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #e74c3c;
}

.messages {
    margin: 20px 0;
}


.help,
.helptext {
    position: absolute;
    top: 100%;
    /* just below the input */
    left: 0;
    width: 100%;
    background: #f4f6f5;
    /* light background */
    border: 1px solid #ddd;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: #333;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-5px);
    /* start slightly up */
    z-index: 10;
    /* ensure it floats above other elements */
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    align-items: stretch;
}

.button-group>* {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.btn-save {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;

}

.btn-cancel_2 {
    background-color: #95a5a6;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    width: 100%;
}


button {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

button:hover {
    background-color: var(--primary-hover);
}

button:active {
    transform: scale(0.98);
}

.retake-btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s ease;
    margin-top: 10px;
}

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

.completion-button {
    background: var(--primary-color);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    margin-top: 20px;
    transition: background 0.2s;
}

.completion-button:hover {
    background: var(--primary-hover);
}

.btn-confirm {
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    margin-right: 10px;
    cursor: pointer;
}



.btn-cancel {
    background: #ccc;
    color: #333;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}



.btn-cancel_2:hover {
    background-color: #7f8c8d;
}



.btn-delete:hover {
    background-color: #c0392b;
}

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

.cta-button {
    display: inline-block;
    background-color: #2ecc71;
    color: white;
    padding: 16px 60px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.cta-button:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

/* Signup link */

.signup-link {
    text-align: center;
    margin-top: 25px;
    color: #555;
}

.signup-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.signup-link a:hover {
    text-decoration: underline;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-weight: 500;
}

/* NAVBAR */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 15px 40px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.navbar-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.navbar-links {
    display: flex;
    gap: 25px;
}

.navbar-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
}

.navbar-links button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font: inherit;
    font-weight: 500;
}

.navbar-links a:hover,
.navbar-links button:hover {
    color: var(--primary-hover);
}

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

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

/* Responsive adjustments */
@media (max-width: 900px) {

    .login-container,
    .signup-container,
    .profile-container,
    .assessment-container {
        flex-direction: column;
    }

    .sidebar {
        max-width: 100%;
    }
}

@media (max-width: 768px) {

    .login-container,
    .signup-container,
    .profile-container,
    .assessment-container {
        flex-direction: column;
        padding: 35px 25px;

    }

    h1 {
        font-size: 24px;
    }

    .topiclist-container h1 {
        font-size: 24px;
    }

    .header {
        padding: 20px;
    }

    .topic-card {
        padding: 18px;
    }

    .lesson-card {
        padding: 18px;
    }
}


@media (max-width: 480px) {

    .login-container,
    .signup-container,
    .profile-container,
    .assessment-container {
        flex-direction: column;
        margin: 20px;
        padding: 30px 20px;
    }

    h1 {
        font-size: 22px;
    }
}