/* Dashboard layout */

.quest_dashboard {
    --quest_gold: #8f6b2f;
    --quest_ink: #3b3021;
    --quest_muted: #706454;
    --quest_border: #e2d5bd;

    width: 94%;
    max-width: 1600px;
    margin: 120px auto 60px;
    color: var(--quest_ink);
    text-align: left;
}

.quest_dashboard,
.quest_dashboard * {
    box-sizing: border-box;
}

.quest_dashboard p {
    max-width: none;
    margin: 0;
    line-height: 1.6;
    font-style: normal;
}

.dashboard_header {
    margin-bottom: 30px;
}

.quest_dashboard .dashboard_eyebrow {
    margin-bottom: 8px;
    color: var(--quest_gold);
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.dashboard_header h1 {
    margin: 0 0 10px;
    font-size: clamp(1.8rem, 4vw, 3rem);
    overflow-wrap: anywhere;
}

.dashboard_header > p:last-child {
    color: var(--quest_muted);
}

.quest_dashboard .dashboard_error {
    margin-bottom: 24px;
    padding: 14px 18px;
    background-color: #fff0ed;
    border: 1px solid #e4b9ae;
    border-radius: 10px;
}

/* Summary cards */

.dashboard_stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat_card {
    padding: 18px 20px;
    background-color: #fffdf8;
    border: 1px solid var(--quest_border);
    border-radius: 12px;
}

.stat_card:has(> .stat_icon) {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat_icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: #f6efe2;
    color: var(--quest_gold);
}

.stat_content {
    min-width: 0;
}

.stat_card h2 {
    margin: 0 0 6px;
    color: var(--quest_muted);
    font-size: 0.95rem;
    font-weight: normal;
}

.quest_dashboard .stat_value {
    color: var(--quest_gold);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: bold;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.dashboard_stats .stat_detail {
    display: none;
}

.quest_dashboard .stat_detail {
    margin-top: 10px;
    color: var(--quest_muted);
    font-size: 0.9rem;
}

/* Dashboard panels */

.dashboard_grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.dashboard_column {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.section_heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel_icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    color: var(--quest_gold);
    background-color: #f6efe2;
}

.goal_editor {
    margin-top: -42px;
    margin-bottom: 20px;
}

.goal_editor > summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: fit-content;
    margin-left: auto;
    color: var(--quest_gold);
    cursor: pointer;
    list-style: none;
}

.goal_editor > summary::-webkit-details-marker {
    display: none;
}

.goal_editor > summary .panel_icon {
    width: 24px;
    height: 24px;
    background: none;
}

.goal_editor[open] {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--quest_border);
}

.goal_editor[open] > summary {
    margin-bottom: 16px;
}

.goal_editor > summary:focus-visible,
.dashboard_history_link:focus-visible {
    outline: 3px solid var(--quest_gold);
    outline-offset: 4px;
}

.dashboard_panel {
    min-width: 0;
    padding: 28px;
    background-color: #fffdf8;
    border: 1px solid var(--quest_border);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgb(59 48 33 / 5%);
}

.dashboard_panel h2 {
    margin: 0 0 14px;
    font-size: 1.3rem;
}

.dashboard_panel > summary {
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
}

.dashboard_panel[open] > summary {
    margin-bottom: 14px;
}

.quest_dashboard .dashboard_muted,
.quest_dashboard .dashboard_empty {
    color: var(--quest_muted);
}

.quest_dashboard .dashboard_progress_value {
    margin: 20px 0 0;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    line-height: 1.4;
}

.quest_dashboard .dashboard_progress_percent {
    text-align: right;
}

.quest_dashboard .progress_bar {
    height: 18px;
    margin: 10px 0 8px;
    background-color: #eee4d2;
    border: none;
    border-radius: 999px;
}

.quest_dashboard .progress_fill {
    height: 100%;
    background-color: var(--quest_gold);
    border-radius: inherit;
    transition: width 0.4s ease;
}

/* Forms */

.dashboard_form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.dashboard_form label {
    font-size: 0.95rem;
    font-weight: bold;
}

.dashboard_form input {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    color: var(--quest_ink);
    background-color: white;
    border: 1px solid #c9b897;
    border-radius: 7px;
    font: inherit;
}

.dashboard_form input:focus-visible {
    outline: 3px solid #d6c39d;
    outline-offset: 2px;
}

.dashboard_form input[readonly] {
    background-color: #fffdf8;
}

.dashboard_form input + label {
    margin-top: 14px;
}

.add_entry_button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.dashboard_form button {
    margin-top: 6px;
    padding: 12px 18px;
    color: white;
    background-color: var(--quest_gold);
    border: none;
    border-radius: 7px;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dashboard_form button:hover {
    background-color: #745525;
}

.dashboard_form button:focus-visible {
    outline: 3px solid var(--quest_gold);
    outline-offset: 3px;
}

/* Recent entries */

.dashboard_panel_heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.dashboard_panel_heading h2 {
    margin: 0;
}

.dashboard_history_link {
    margin-left: auto;
    color: var(--quest_gold);
    text-decoration: none;
}

.dashboard_history_link:hover {
    text-decoration: underline;
}

.dashboard_badge {
    padding: 4px 10px;
    color: var(--quest_gold);
    background-color: #f6efe2;
    border-radius: 999px;
    font-size: 0.8rem;
}

.dashboard_entries {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard_entries li {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--quest_border);
}

.dashboard_entries li:last-child {
    border-bottom: none;
}

.dashboard_entries span {
    color: var(--quest_muted);
}

.dashboard_entries strong {
    color: var(--quest_gold);
}

.dashboard_setup {
    max-width: 550px;
}

.quest_onboarding {
    margin-inline: auto;
}

.quest_dashboard #goal_celebration {
    margin-bottom: 24px;
    padding: 16px 20px;
    color: #3b3021;
    background-color: #f6efe2;
    border: 1px solid #8f6b2f;
    border-radius: 10px;
    font-weight: bold;
}

.quest_dashboard .dashboard_notice {
    margin-bottom: 20px;
    padding: 14px 18px;
    background-color: #f6efe2;
    border: 1px solid var(--quest_border);
    border-radius: 10px;
}

.quest_dashboard .dashboard_project {
    color: var(--quest_gold);
    font-size: 1.2rem;
    font-weight: bold;
    overflow-wrap: anywhere;
}

.dashboard_new_quest {
    margin-top: 24px;
}

.dashboard_recent_table {
    overflow: auto;
    border: 1px solid var(--quest_border);
    border-radius: 8px;
}

.dashboard_recent_table tbody tr:last-child td {
    border-bottom: none;
}

.history_table_wrapper {
    overflow-x: auto;
}

.history_table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.history_caption {
    padding: 0 0 16px;
    color: var(--quest_muted);
    text-align: left;
}

.history_table th,
.history_table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--quest_border);
}

.history_table th {
    color: var(--quest_gold);
    background-color: #f6efe2;
}

.history_table td {
    vertical-align: top;
    overflow-wrap: anywhere;
}

.history_table th:last-child,
.history_table td:last-child {
    text-align: right;
    white-space: nowrap;
}

.history_clear_panel {
    margin-top: 24px;
}

.history_confirmation {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.dashboard_form .history_confirmation input {
    width: auto;
    margin-top: 4px;
    flex-shrink: 0;
}

.dashboard_form .danger_button {
    background-color: #963d32;
}

.dashboard_form .danger_button:hover {
    background-color: #752d25;
}

.draft_quest_home {
    width: 90%;
    max-width: 800px;
    margin: 120px auto 40px;
    text-align: center;
}

.draft_quest_home h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.draft_quest_home p {
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.draft_quest_actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
}

.draft_quest_button {
    display: inline-block;
    padding: 12px 24px;
    background-color: #8f6b2f;
    color: white;
    text-decoration: none;
    border-radius: 6px;
}

.confetti_layer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    overflow: hidden;
    pointer-events: none;
}

.confetti_piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 16px;
    border-radius: 2px;
    animation-name: confetti_fall;
    animation-timing-function: linear;
    animation-fill-mode: both;
}

.profile_details {
    margin: 0;
}

.profile_details dt {
    margin-top: 20px;
    color: var(--quest_muted);
    font-weight: bold;
}

.profile_details dd {
    margin: 6px 0 0;
    overflow-wrap: anywhere;
}

.weekly_graph {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
    margin-top: 24px;
}

.weekly_axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 160px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--quest_muted);
}

.weekly_axis span {
    line-height: 1;
    transform: translateY(-50%);
}

.weekly_chart {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.weekly_chart_day {
    min-width: 0;
    text-align: center;
    font-size: 0.8rem;
}

.weekly_chart_track {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 160px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--quest_border);
    border-left: 1px solid var(--quest_border);
    background-image: repeating-linear-gradient(to top, transparent 0, transparent 39px, var(--quest_border) 39px, var(--quest_border) 40px);
}

.weekly_chart_bar {
    width: 70%;
    background-color: var(--quest_gold);
    border-radius: 0;
}

.quest_dashboard.profile_page {
    max-width: 1100px;
}

.profile_layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

.profile_summary {
    padding: 32px 24px;
    text-align: center;
    background-color: #fffdf8;
    border: 1px solid var(--quest_border);
    border-radius: 16px;
}

.profile_avatar_picker {
    position: relative;
    width: 112px;
    height: 112px;
    margin: 0 auto 20px;
}

.profile_avatar_picker input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border-radius: 50%;
}

.profile_avatar_picker:focus-within {
    outline: 3px solid var(--quest_gold);
    outline-offset: 4px;
    border-radius: 50%;
}

.profile_avatar {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background-color: #f6efe2;
    color: var(--quest_gold);
    font-size: 3rem;
    font-weight: bold;
}

.profile_avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile_avatar_action {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 6px 0 10px;
    background-color: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 0.7rem;
    font-weight: normal;
}

.profile_summary h2 {
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}

.profile_page .profile_summary p {
    color: var(--quest_muted);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.profile_settings {
    display: grid;
    gap: 24px;
    min-width: 0;
}

.profile_settings .dashboard_setup {
    max-width: none;
    width: 100%;
    margin: 0;
}

@media (max-width: 760px) {
    .profile_layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }
}

@keyframes confetti_fall {
    from {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }

    to {
        transform:
            translate3d(var(--confetti_drift), calc(100vh + 40px), 0)
            rotate(720deg);
    }
}

/* Mobile layout */

@media (min-width: 701px) and (max-width: 1100px) {
    .dashboard_stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .confetti_layer {
        display: none;
    }
}

@media (max-width: 700px) {
    .dashboard_stats,
    .dashboard_grid {
        grid-template-columns: 1fr;
    }

    .dashboard_stats,
    .dashboard_grid {
        gap: 16px;
    }

    .stat_card,
    .dashboard_panel {
        padding: 22px;
    }

    .goal_editor {
        margin-top: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .quest_dashboard .progress_fill,
    .dashboard_form button {
        transition: none;
    }
}

/* Registration */
.quest_dashboard.registration_page {
    max-width: 520px;
}

.registration_card {
    padding: clamp(24px, 5vw, 40px);
    border-radius: 20px;
}

.registration_card .dashboard_header h1 {
    font-size: clamp(1.8rem, 5vw, 2.3rem);
}

.registration_card .dashboard_header > p:last-child {
    font-size: 1rem;
}

.password_help {
    color: var(--quest_muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.registration_page .registration_login {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--quest_border);
    text-align: center;
    font-size: 0.95rem;
}

.registration_login a {
    color: var(--quest_gold);
    font-weight: bold;
    text-underline-offset: 3px;
}

.profile_error {
    color: #b91c1c;
    background-color: #fef2f2;
    border-left: 4px solid #b91c1c;
    padding: 0.75rem 1rem;
    font-weight: 600;
}
