:root {
    --steps-purple-dark: #800080;
    --steps-purple-light: #f2e6f2;
    --steps-purple-hover: #6a006a;
    --steps-text-color: #333;
    --steps-text-color-light: #ffffff;
    --bg-secondary: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --text-secondary: #6b7280;
    --text-primary: #111827;
}

/* Student Dashboard Styles */
.student-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.student-dashboard-shell {
    padding-top: 20px;
    padding-bottom: 20px;
}

.student-dashboard h2 {
    color: var(--steps-purple-dark);
    margin-bottom: 24px;
}

.student-dashboard-header {
    text-align: center;
    margin-bottom: 30px;
}

.student-dashboard-header h2 {
    margin-bottom: 8px;
    text-align: center;
}

.student-dashboard-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.egh-dashboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-left: 0;
    list-style: none;
    justify-content: center;
}

.egh-dashboard-tab {
    padding: 10px 20px;
    cursor: pointer;
    background-color: var(--steps-purple-light);
    color: var(--steps-text-color);
    border: 1px solid #d1b3d1;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    flex-grow: 0;
    flex-shrink: 0;
}

.egh-dashboard-tab:hover {
    background-color: var(--steps-purple-hover);
    color: var(--steps-text-color-light);
    border-color: var(--steps-purple-hover);
}

.egh-dashboard-tab.is-active {
    background-color: var(--steps-purple-dark);
    color: var(--steps-text-color-light);
    font-weight: 700;
    border-color: var(--steps-purple-dark);
}

.egh-dashboard-tab-content {
    display: none;
    padding: 25px;
    border: 1px solid var(--steps-purple-dark);
    background-color: #ffffff;
    border-radius: 5px;
    box-shadow: 0 3px 6px rgba(128, 0, 128, 0.1), 0 3px 6px rgba(128, 0, 128, 0.1);
}

.egh-dashboard-tab-content.is-active {
    display: block;
}

.account-settings-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.account-settings-main {
    flex: 2;
    min-width: 300px;
}

.account-settings-sidebar {
    flex: 1;
    min-width: 250px;
    align-self: flex-start;
}

.account-settings-bottom {
    flex-basis: 100%;
}

.account-settings-box {
    border: 2px solid var(--steps-purple-dark);
    padding: 20px;
    border-radius: 25px 5px 25px 5px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.account-settings-box h2 {
    padding-bottom: 10px;
    border-bottom: 2px solid var(--steps-purple-dark);
    margin-bottom: 20px;
    text-align: left;
}

.student-role-badge,
.user-role-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--steps-purple-light);
    color: var(--steps-purple-dark);
    font-size: 0.9rem;
    font-weight: 700;
}

.user-role-badge.role-subscriber {
    background: var(--steps-purple-light);
    color: var(--steps-purple-dark);
}

.student-preferences-box {
    margin-top: 4px;
}

.student-language-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.student-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.student-setting-label {
    width: 200px;
    max-width: 100%;
    font-weight: 600;
    color: var(--steps-purple-dark);
    white-space: nowrap;
    flex-shrink: 0;
}

.student-setting-control {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.student-setting-control-toggle {
    min-height: 24px;
}

.egh-lang-select,
.egh-level-select {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #d1b3d1;
    color: var(--steps-purple-dark);
    background-color: #ffffff;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.2s;
}

.egh-lang-select:focus,
.egh-level-select:focus {
    border-color: var(--steps-purple-dark);
    outline: none;
    box-shadow: 0 0 0 2px var(--steps-purple-light);
}

.lang-status-icon {
    margin-left: 10px;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--steps-purple-dark);
}

.lang-status-icon .egh-tc-loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0;
}

.lang-status-icon .egh-tc-loading-spinner::before {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.hockey-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.hockey-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.hockey-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.hockey-toggle-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 4px;
    bottom: 4px;
    background-color: #ffffff;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .hockey-toggle-slider {
    background-color: var(--steps-purple-dark);
}

input:checked + .hockey-toggle-slider:before {
    transform: translateX(20px);
}

.hockey-toggle-switch input:disabled + .hockey-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.egh-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.egh-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.egh-modal-content {
    background-color: #fefefe;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.egh-modal.is-open .egh-modal-content {
    transform: scale(1);
    opacity: 1;
}

.egh-close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    color: #aaa;
}

.egh-close:hover {
    color: #000;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

#teacher-connect-code {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--steps-purple-dark);
    border: 2px solid #d1b3d1;
    border-radius: 10px;
    padding: 14px 16px;
}

#teacher-connect-code::placeholder {
    color: #9a73ad;
    opacity: 1;
}

#teacher-connect-code:focus {
    border-color: var(--steps-purple-dark);
    box-shadow: 0 0 0 3px rgba(128, 0, 128, 0.12);
    outline: none;
}

.form-actions {
    text-align: right;
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-save {
    background-color: var(--steps-purple-dark);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-cancel {
    background-color: #f3f4f6;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.student-connect-sidebar .purchase-credits-button {
    margin-top: 18px;
}

.student-dashboard-actions {
    margin-top: 24px;
}

.student-switch-link {
    background-color: #6c757d;
}

.student-switch-link:hover {
    background-color: #4b5563;
}

.student-dashboard-placeholder {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
    padding: 48px 24px;
    border: 2px dashed #d1b3d1;
    border-radius: 24px 6px 24px 6px;
    background: linear-gradient(135deg, #fcf6ff 0%, #f7edfb 100%);
}

.student-dashboard-placeholder h2 {
    text-align: center;
    margin-bottom: 12px;
}

.student-dashboard-placeholder p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.student-linked-exercises-section {
    max-width: 1200px;
    margin: 0 auto;
}

.student-linked-exercises-header {
    text-align: center;
    margin-bottom: 28px;
}

.student-linked-exercises-header h2 {
    text-align: center;
    margin-bottom: 10px;
}

.student-linked-exercises-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.student-linked-exercises-grid {
    align-items: stretch;
}

.student-linked-exercise-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

.student-linked-exercise-link:hover,
.student-linked-exercise-link:focus {
    color: inherit;
    text-decoration: none;
}

.student-linked-exercise-link *,
.student-linked-exercise-link:hover *,
.student-linked-exercise-link:focus * {
    text-decoration: none !important;
}

.student-linked-exercise-link:focus-visible .exercise-card {
    outline: 3px solid rgba(128, 0, 128, 0.18);
    outline-offset: 4px;
}

.student-dashboard-shell .egh-tc-tab-panel.is-active,
.student-linked-exercises-section .exercise-card-grid,
.student-linked-exercise-link,
.student-linked-exercise-link .exercise-card,
.student-linked-exercise-link .card-content,
.student-linked-exercise-link .vocabulary-list,
.student-linked-exercise-link .vocabulary-list li {
    overflow: visible;
}

.student-linked-exercise-link .tooltip {
    z-index: 50;
}

.student-teacher-notice {
    margin-top: 15px;
    padding: 12px 14px;
    border-radius: 8px;
}

.student-teacher-notice.success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.student-teacher-notice.error,
.teacher-connect-feedback.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.teacher-connect-feedback.success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.teacher-connect-feedback {
    padding: 10px 12px;
    border-radius: 8px;
}

.teacher-disconnect-button {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid #b91c1c;
    border-radius: 8px;
    background: #fff1f2;
    color: #991b1b;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.teacher-disconnect-button:hover {
    background: #fee2e2;
}

.teacher-disconnect-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.dashboard-actions {
    text-align: center;
    margin-top: 30px;
}

/* Login Submit Link (inherited from login plugin) */
.login-submit-link {
    display: inline-block;
    background-color: var(--steps-purple-dark);
    color: var(--steps-text-color-light);
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    text-align: center;
}

.login-submit-link:hover {
    background-color: var(--steps-purple-hover);
    text-decoration: none;
}

.purchase-credits-button {
    background-color: var(--steps-purple-dark);
    color: #ffffff;
    padding: 10px 25px;
    border-radius: 8px;
    text-decoration: none;
    display: block;
    margin: 20px auto 0;
    width: fit-content;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
    font-weight: 700;
}

.purchase-credits-button:hover {
    background-color: var(--steps-purple-hover);
    color: #ffffff;
}

/* Custom Login Container (for switch messages) */
.custom-login-container {
    max-width: 400px;
    margin: 2em auto;
    padding: 25px;
    border: 1px solid #d1b3d1;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    background-color: var(--steps-text-color-light);
}

.custom-login-container h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--steps-purple-dark);
}

.login-message {
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    text-align: center;
    line-height: 1.5;
}

.login-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .student-dashboard {
        padding: 15px;
    }

    .egh-dashboard-tab {
        flex-basis: calc(50% - 5px);
        font-size: 13px;
        padding: 8px 12px;
    }

    .egh-dashboard-tab-content {
        padding: 18px;
    }

    .student-setting-row {
        align-items: flex-start;
    }

    .student-setting-label {
        width: 100%;
        white-space: normal;
    }
}

@media (max-width: 480px) {
    .egh-dashboard-tab {
        flex-basis: 100%;
    }
}

/* --- VOCABULARY LIST STYLES --- */
.student-vocabulary-list-section {
    max-width: 860px;
    margin: 0 auto 40px;
}

.student-vocabulary-list-section h3 {
    color: var(--steps-purple-dark);
    margin-bottom: 20px;
}

.no-words-message {
    background: #fff;
    border: 1px dashed #d1b3d1;
    border-radius: 12px;
    color: var(--text-secondary);
    padding: 20px;
    text-align: center;
}

.no-words-message p {
    margin: 0;
}

.vocab-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.vocab-sort-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
    /* Allow horizontal scroll for filters if needed on tiny screens */
}

.vocab-sort-controls button {
    background-color: var(--bg-secondary);
    border: 1px solid #d1d5db;
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.vocab-sort-controls button.is-active {
    background-color: var(--steps-purple-dark);
    color: white;
    border-color: var(--steps-purple-dark);
}

.sort-arrow {
    transition: transform 0.3s ease;
    display: inline-block;
}

.sort-arrow.is-desc {
    transform: rotate(180deg);
}

.vocab-grid-container {
    display: block;
    position: relative;
}

#vocab-grid,
#vocab-grid-today {
    display: flex;
    gap: 16px;
    align-items: start;
}

.vocab-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

@media (max-width: 768px) {

    #vocab-grid,
    #vocab-grid-today {
        flex-direction: column;
    }
}

.vocab-item-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    border: 1px solid #e5e7eb;
    border-left: 5px solid transparent;
    /* Add space for the weight border */
}

.vocab-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Weight-based Colors */
.vocab-item-card.weight--low {
    border-left-color: #ef4444;
    /* red */
}

.vocab-item-card.weight--medium {
    border-left-color: #f59e0b;
    /* orange */
}

.vocab-item-card.weight--high {
    border-left-color: #22c55e;
    /* green */
}

.vocab-card-header {
    padding: 16px;
    font-size: 1.125rem;
    font-weight: 600;
    border-bottom: 1px solid #f3f4f6;
    background-color: #f9fafb;
    display: flex;
    /* Flex layout for audio button and text */
    align-items: center;
}

.esl-audio-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--steps-purple-dark);
    width: 28px;
    height: 28px;
    box-sizing: border-box;
    border-radius: 50%;
    margin-right: 10px;
    /* Space between button and text */
    padding: 4px;
    /* Add padding inside circle */
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    /* Prevent shrinking */
    color: var(--steps-purple-dark);
    /* Use theme color */
}

.esl-audio-button svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    display: block;
}

.esl-audio-button:hover {
    background-color: var(--steps-purple-dark);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.esl-audio-button:active {
    transform: scale(0.95);
}

.word-type {
    font-style: italic;
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-left: 5px;
}

.vocab-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    padding: 0 16px;
}

.vocab-item-card.is-expanded .vocab-card-body {
    max-height: 2000px;
    padding: 0 16px 16px;
}

.vocab-item-card {
    cursor: pointer;
}

.vocab-card-body p {
    margin: 0 0 10px 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.vocab-card-body p:last-child {
    margin-bottom: 0;
}

.vocab-card-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Actions Row Buttons */
.vocab-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.vocab-action-btn {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 0.75em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    line-height: 1;
    color: var(--text-secondary);
    font-weight: 600;
}

.vocab-action-btn:hover {
    background: #f9fafb;
    border-color: #ccc;
}

.btn-thumbs-down {
    /* light red style */
}

.btn-thumbs-down:hover {
    color: #d9534f;
    border-color: #d9534f;
    background: #fff5f5;
}

.btn-thumbs-up {
    /* light green style */
}

.btn-thumbs-up:hover {
    color: #22c55e;
    border-color: #22c55e;
    background: #f0fdf4;
}

.btn-edit:hover {
    color: var(--steps-purple-dark);
    border-color: var(--steps-purple-dark);
}

.btn-delete:hover {
    color: #ef4444;
    border-color: #ef4444;
}
