* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.card {
    width: 100%;
    max-width: 620px;
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.wide-card {
    max-width: 760px;
}

h1 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 32px;
}

h2 {
    font-size: 22px;
}

p {
    line-height: 1.5;
}

.help-text {
    margin: -8px 0 0;
    color: #64748b;
    font-size: 14px;
}

.upload-form {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

label {
    font-weight: bold;
}

input[type="file"],
input[type="password"],
input[type="text"] {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

button,
.button-link {
    display: inline-block;
    width: fit-content;
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    background: #2563eb;
    color: white;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button-link:hover {
    background: #1d4ed8;
}

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

.details {
    margin: 24px 0;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.secondary-link {
    display: inline-block;
    margin-left: 12px;
    color: #2563eb;
    font-weight: bold;
    text-decoration: none;
}

.secondary-link:hover {
    text-decoration: underline;
}

.top-actions {
    margin-top: -4px;
    margin-bottom: 18px;
    text-align: right;
}

.top-actions a,
.drive-status a {
    color: #2563eb;
    font-weight: bold;
    text-decoration: none;
}

.top-actions a:hover,
.drive-status a:hover {
    text-decoration: underline;
}

.drive-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 12px 0 20px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 14px;
}

.drive-connected {
    color: #166534;
    font-weight: bold;
}

.drive-disconnected {
    color: #92400e;
    font-weight: bold;
}

.progress-panel {
    margin-top: 28px;
    padding: 20px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #dbeafe;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.progress-header h2 {
    margin: 0;
    font-size: 22px;
}

#progressPercent,
#driveProgressPercent {
    font-weight: bold;
    color: #2563eb;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 18px;
    margin-top: 16px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    width: 200%;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(37, 99, 235, 0.16) 0,
        rgba(37, 99, 235, 0.16) 12px,
        rgba(37, 99, 235, 0.34) 12px,
        rgba(37, 99, 235, 0.34) 24px
    );
    animation: progress-stripes 6s linear infinite;
    z-index: 1;
}

.progress-fill {
    position: relative;
    height: 100%;
    width: 0%;
    background: rgba(37, 99, 235, 0.75);
    border-radius: 999px;
    transition: width 0.35s ease;
    z-index: 2;
}

@keyframes progress-stripes {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-96px);
    }
}

.progress-message {
    margin-top: 14px;
    color: #52606d;
}

.summary-box {
    margin-top: 18px;
    padding: 14px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.summary-box p {
    margin: 6px 0;
}

.action-row {
    margin-top: 18px;
}

.drive-upload-panel {
    margin-top: 24px;
    padding: 18px;
    border-radius: 14px;
    background: white;
    border: 1px solid #dbeafe;
}

.drive-upload-panel h2 {
    margin-top: 0;
}

.drive-upload-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drive-progress-box {
    margin-top: 18px;
}

.error-panel {
    margin-top: 24px;
    padding: 18px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    color: #991b1b;
}

.error-panel h2 {
    margin-top: 0;
}

.login-error {
    margin: 18px 0;
    padding: 14px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-weight: bold;
}

.hidden {
    display: none !important;
}

@media (max-width: 640px) {
    .page {
        padding: 16px;
    }

    .card {
        padding: 24px;
    }

    .drive-status,
    .progress-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Review/browser selection UI */
.review-panel {
    margin-top: 24px;
    padding: 18px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #dbeafe;
}

.review-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.review-header h2 {
    margin-top: 0;
    margin-bottom: 8px;
}

.review-header p {
    margin-top: 0;
    color: #52606d;
}

.review-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.secondary-button {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 12px;
    background: #f8fafc;
    color: #1f2933;
    font-weight: bold;
    cursor: pointer;
}

.secondary-button:hover {
    background: #e2e8f0;
}

.selection-summary {
    margin: 12px 0 16px;
    padding: 10px 12px;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 10px;
}

.item-browser {
    max-height: 520px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.course-group,
.module-group {
    border-bottom: 1px solid #e2e8f0;
}

.course-group:last-child,
.module-group:last-child {
    border-bottom: none;
}

.course-group > summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: bold;
    background: #e0f2fe;
    color: #075985;
}

.module-group > summary {
    padding: 12px 24px;
    cursor: pointer;
    font-weight: bold;
    background: #f1f5f9;
    color: #334155;
}

.review-item {
    display: flex;
    gap: 12px;
    padding: 12px 24px 12px 36px;
    background: #ffffff;
    border-top: 1px solid #edf2f7;
    cursor: pointer;
}

.review-item:hover {
    background: #f8fafc;
}

.review-item input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.review-item-content {
    display: grid;
    gap: 4px;
}

.review-item-title {
    font-weight: bold;
    color: #1f2933;
}

.review-item-meta {
    font-size: 13px;
    color: #64748b;
    overflow-wrap: anywhere;
}

.review-item-notes {
    font-size: 13px;
    color: #92400e;
}

.empty-browser {
    padding: 18px;
    color: #64748b;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

button.button-link {
    font-family: inherit;
}

.quiz-convert-button {
    align-self: center;
    margin-left: 12px;
    border: none;
    border-radius: 8px;
    padding: 9px 12px;
    background: #7c3aed;
    color: white;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.quiz-convert-button:hover {
    background: #6d28d9;
}

.quiz-convert-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
