/* Base Theme Styles */
:root {
    --primary-color: #0066cc;
    --primary-hover: #004c99;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --border-color: #e5e7eb;
    --radius: 8px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #fdfdf9;
    background-image:
        linear-gradient(90deg, transparent 59px, #f0b8bd 59px, #f0b8bd 61px, transparent 61px),
        repeating-linear-gradient(
            180deg,
            transparent,
            transparent 27px,
            #cfe0f0 27px,
            #cfe0f0 28px
        );
    background-position: 0 90px, 0 90px;
    color: var(--text-main);
    margin: 0;
    padding: 90px 20px 40px 20px;
    display: flex;
    justify-content: center;
}

/* Centered Wrapper */
.container {
    max-width: 600px;
    width: 100%;
    margin-top: 100px;
}

/* Home page wrapper is wider so the quiz-generation tile can be enlarged */
.container--home {
    max-width: 825px;
}

/* Header Layout */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 30px; /* Spacing between the Title and the left-aligned buttons */
    padding: 16px 32px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    z-index: 100;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header h1 span {
    color: var(--primary-color);
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 8px;
    flex-grow: 1; /* Stretches across remaining header space */
    justify-content: flex-end; /* Pushes all buttons in this group to the right */
}

button, input[type="submit"] {
    font-family: inherit;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline {
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover:not(:disabled) {
    background-color: #f3f4f6;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f3f4f6;
}


/* Alerts */
.alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 500px;
    z-index: 1000;
    box-sizing: border-box;

    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background-color: #def7ec;
    color: #03543f;
    border: 1px solid #bcdecb;
}

.alert-error {
    background-color: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #f8b4b4;
}

.alert-close {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* Form Area styling */
.form-card {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
}

.form-card p {
    margin-top: 0;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 1.1rem;
}

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

input[type="text"] {
    flex-grow: 1;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Roughly double the size of the "Generate a quiz from a video" tile on the home page */
.form-card--quiz {
    padding: 42px;
    border-radius: 12px;
}

.form-card--quiz p {
    font-size: 1.5rem;
    margin-bottom: 21px;
}

.form-card--quiz .input-group {
    gap: 14px;
}

.form-card--quiz input[type="text"] {
    padding: 15px 18px;
    font-size: 1.125rem;
    border-radius: 9px;
}

.form-card--quiz #submitBtn {
    padding: 14px 26px;
    font-size: 1rem;
    border-radius: 9px;
}


input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1); /* A subtle blue glow */
}



#discoverButton {
    margin-right: auto;
}

/* Simulated quiz-generation progress bar */
.loading-container {
    margin-top: 16px;
}

.loading-bar-track {
    width: 100%;
    height: 8px;
    background-color: #f3f4f6;
    border-radius: 999px;
    overflow: hidden;
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 999px;
    transition: width 0.2s ease-out;
}

.loading-status-text {
    margin: 8px 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
    text-align: center;
}



/* Submit Button Styling */
#submitBtn {
    background-color: var(--primary-color);
    color: white; /* Keeps the text readable against the blue */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#submitBtn:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

/* Spinner shown on the submit button while a quiz is generating */
.spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

#submitBtn.is-loading .spinner {
    display: inline-block;
}

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

/* Locked appearance for the URL field once submission has started */
input[type="text"][readonly] {
    background-color: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

/* Buttons shown under the tile once a quiz has finished generating */
.post-generation-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}



/* --- Dropdown Menu Styling --- */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Circular avatar placeholder for the profile menu trigger */
.profile-avatar-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background-color: transparent;
    color: var(--text-color, #333);
    border: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    transition: all 0.2s ease;
    overflow: hidden;
}

.profile-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-style: solid;
    border-color: var(--primary-color);
}

/* Larger profile picture shown on the profile page itself */
.profile-picture {
    display: block;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background-color: var(--card-bg);
    min-width: 200px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    z-index: 1000;
}

/* Class added via JavaScript to reveal the menu */
.dropdown-content.show {
    display: flex;
    flex-direction: column;
}

/* Individual options inside the dropdown */
.dropdown-item {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    border-radius: 0;
    color: var(--text-main);
    font-size: 0.9rem;
    white-space: nowrap;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

/* Sub-item nested under "My Docks" to show it belongs to that section */
.dropdown-item--nested {
    padding-left: 32px;
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
}