/*
 * PrivateChat authenticated dashboard.
 * These rules are scoped to .dashboard-body so that
 * login, settings and conversation pages stay unchanged.
 */

 .dashboard-body {
    --dashboard-row-height: 78px;
    --dashboard-row-gap: 8px;

    background:
        linear-gradient(
            145deg,
            #f5f6f5 0%,
            #f1f3f2 58%,
            #f6f6f5 100%
        );
}


/* Account and actions */

.dashboard-body .app-topbar {
    min-height:
        calc(
            72px
            + env(safe-area-inset-top)
        );

    padding-right:
        max(22px, env(safe-area-inset-right));

    padding-left:
        max(22px, env(safe-area-inset-left));

    background:
        rgba(250, 251, 250, 0.96);
}

.dashboard-identity {
    display: flex;
    align-items: center;
    gap: 11px;

    min-width: 0;
}

.dashboard-brand-mark {
    display: grid;
    place-items: center;

    flex: 0 0 36px;

    width: 36px;
    height: 36px;

    border: 1px solid #d5dfd9;
    border-radius: 11px;

    background: #e9efeb;
    color: #284c3a;

    font-size: 17px;
    font-weight: 800;
}

.dashboard-account {
    display: flex;
    flex-direction: column;
    gap: 2px;

    min-width: 0;
}

.dashboard-account-label {
    color: #727c76;

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.2;
    text-transform: uppercase;
}

.dashboard-body .topbar-username {
    display: block;
    flex: none;

    max-width: 170px;

    overflow: hidden;

    font-size: 13px;
    font-weight: 750;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-settings-button {
    display: grid;
    place-items: center;

    flex: 0 0 36px;

    width: 36px;
    height: 36px;
    margin-left: 3px;

    border: 1px solid #dfe4e0;
    border-radius: 11px;

    background: #ffffff;
    color: #34453b;

    text-decoration: none;
}

.dashboard-settings-button svg {
    width: 17px;
    height: 17px;
}

.dashboard-settings-button:hover {
    background: #edf2ee;
    border-color: #bccdc1;
}

.dashboard-body .topbar-actions {
    gap: 9px;
}

.dashboard-body .topbar-button {
    min-height: 40px;
    padding: 0 15px;

    border: 1px solid transparent;
    border-radius: 11px;

    font-size: 12px;
    font-weight: 750;

    transition:
        background 140ms ease,
        border-color 140ms ease,
        transform 140ms ease;
}

.dashboard-body .topbar-create-button {
    background: #233d30;
    color: #ffffff;
}

.dashboard-body .topbar-create-button:hover {
    background: #315342;
}

.dashboard-body .topbar-destroy-button {
    background: #ffffff;
    border-color: #e5d8d5;
    color: #8b3e36;
}

.dashboard-body .topbar-destroy-button:not(:disabled):hover {
    background: #fbefec;
    border-color: #d9b7b0;
}

.dashboard-body .topbar-button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.dashboard-body .topbar-button:not(:disabled):active {
    transform: translateY(1px);
}


/* Fixed desktop workspace */

.dashboard-body .dashboard-page {
    display: grid;
    grid-template-columns:
        minmax(340px, 440px)
        minmax(0, 1fr);
    gap: 18px;

    width: 100%;
    max-width: 1180px;

    height: 100dvh;
    min-height: 0;
    margin: 0 auto;

    padding:
        calc(72px + env(safe-area-inset-top) + 22px)
        max(22px, env(safe-area-inset-right))
        max(22px, env(safe-area-inset-bottom))
        max(22px, env(safe-area-inset-left));

    overflow: hidden;
}

.dashboard-room-panel,
.dashboard-detail-panel {
    min-width: 0;
    min-height: 0;

    border: 1px solid #e0e5e0;
    border-radius: 20px;

    background: rgba(255, 255, 255, 0.92);

    box-shadow:
        0 12px 36px rgba(32, 48, 38, 0.035);
}

.dashboard-room-panel {
    display: flex;
    flex-direction: column;

    padding: 18px;
    overflow: hidden;
}

.dashboard-body .dashboard-heading {
    padding: 0 1px 16px;
}

.dashboard-body .dashboard-heading h1 {
    font-size: 25px;
    font-weight: 780;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.dashboard-body .dashboard-heading p {
    margin-top: 6px;

    font-size: 12px;
    line-height: 1.45;
}

.dashboard-selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    min-height: 35px;
    margin-bottom: 10px;
    padding: 0 2px;

    border-top: 1px solid #edf0ed;

    color: #68756c;
    font-size: 11px;
    font-weight: 650;
}

.dashboard-selection-limit {
    color: #8a938c;
    font-size: 10px;
}

.dashboard-body #dashboard-loading,
.dashboard-body #empty-room-state {
    margin: 4px 0 0;
    padding: 22px 8px;

    color: #66736a;
    font-size: 13px;
    line-height: 1.55;
}

.dashboard-body #empty-room-state strong {
    color: #24362a;
    font-size: 15px;
}

.dashboard-feedback {
    margin: 0 0 10px;
    padding: 10px 12px;

    border: 1px solid #dce7df;
    border-radius: 11px;

    background: #f2f7f3;
    color: #315c3e;

    font-size: 12px;
    line-height: 1.45;
}

.dashboard-feedback[data-tone="error"] {
    border-color: #ebd2cd;
    background: #fdf3f1;
    color: #8b3e36;
}

.dashboard-body .room-list {
    flex: 0 1 auto;
    gap: var(--dashboard-row-gap);

    min-height: 0;
    max-height:
        calc(
            5 * var(--dashboard-row-height)
            + 4 * var(--dashboard-row-gap)
        );

    padding: 1px 4px 4px 1px;

    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: #b8c8bb #eef2ee;
    scrollbar-width: thin;
}

.dashboard-body .room-list-item {
    flex: 0 0 var(--dashboard-row-height);

    grid-template-columns: 40px minmax(0, 1fr);

    height: var(--dashboard-row-height);
    min-height: var(--dashboard-row-height);

    border-color: #e6eae6;
    border-radius: 13px;

    background: #ffffff;
}

.dashboard-body .room-list-item:hover {
    border-color: #cad7cc;
    background: #fcfdfc;
}

.dashboard-body .room-list-item.selected {
    border-color: #8cae97;
    background: #f0f6f1;
}

.dashboard-body .room-selector {
    width: 40px;
}

.dashboard-body .room-selector-circle {
    width: 18px;
    height: 18px;

    border-color: #9eaaa0;
}

.dashboard-body .room-selector[aria-pressed="true"]
.room-selector-circle {
    border-color: #315b41;
}

.dashboard-body .room-open-button {
    padding: 10px 12px 9px 1px;
}

.dashboard-body .room-item-title {
    font-size: 13px;
}

.dashboard-body .room-item-preview {
    font-size: 11px;
}

.dashboard-body .room-item-time,
.dashboard-body .room-item-code {
    font-size: 10px;
}

.dashboard-body .room-item-status {
    margin-top: 5px;
    font-size: 10px;
}

.dashboard-scroll-cue {
    display: flex;
    align-items: center;
    gap: 7px;

    margin: 10px 2px 0;

    color: #66776a;
    font-size: 11px;
    font-weight: 650;
}

.dashboard-scroll-cue svg {
    width: 14px;
    height: 14px;
}

.dashboard-detail-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    padding: clamp(22px, 4vw, 48px);
}

.dashboard-detail-eyebrow {
    margin: 0 0 12px;

    color: #617566;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.dashboard-detail-panel h2 {
    max-width: 420px;
    margin: 0;

    color: #203628;
    font-size: clamp(25px, 3vw, 38px);
    font-weight: 780;
    letter-spacing: -0.05em;
    line-height: 1.12;
}

.dashboard-detail-copy {
    max-width: 420px;
    margin: 14px 0 0;

    color: #65736a;
    font-size: 13px;
    line-height: 1.65;
}

.dashboard-detail-footnote {
    max-width: 420px;
    margin: 28px 0 0;
    padding-top: 15px;

    border-top: 1px solid #e9eeea;

    color: #7a867c;
    font-size: 11px;
    line-height: 1.55;
}


/* Creation dialog */

.dashboard-body #create-room-dialog {
    width: min(420px, calc(100% - 28px));
    max-width: 420px;
    padding: 24px;

    border: 1px solid #dce5dd;
    border-radius: 18px;

    background: #ffffff;
    color: #26372b;

    box-shadow:
        0 25px 90px rgba(21, 36, 26, 0.17);
}

.dashboard-body #create-room-dialog::backdrop {
    background: rgba(27, 39, 31, 0.42);
    backdrop-filter: blur(4px);
}

.dashboard-body #create-room-form h2 {
    margin: 0 0 8px;

    font-size: 21px;
    letter-spacing: -0.035em;
}

.dashboard-body #create-room-form p {
    color: #68756b;
    font-size: 12px;
    line-height: 1.55;
}

.dashboard-body #room-duration-select {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;

    border: 1px solid #cbd7cd;
    border-radius: 11px;

    background: #f9fbf9;
    color: #26372b;

    font-size: 14px;
}

.dashboard-body #create-room-form
.room-action-button.primary {
    background: #233d30;
}

.dashboard-body #create-room-form
.room-action-button.primary:hover {
    background: #315342;
}

.dashboard-body #create-room-form
.room-action-button.secondary {
    background: #eff2ef;
}

.dashboard-body :is(
    button,
    a,
    select
):focus-visible {
    outline: 2px solid #3e7550;
    outline-offset: 3px;
}


/* Mobile: chats first, page may scroll */

@media (max-width: 767px) {
    .dashboard-body .app-topbar {
        flex-wrap: wrap;
        gap: 8px;

        min-height:
            calc(
                112px
                + env(safe-area-inset-top)
            );

        padding:
            calc(10px + env(safe-area-inset-top))
            max(14px, env(safe-area-inset-right))
            10px
            max(14px, env(safe-area-inset-left));
    }

    .dashboard-identity {
        flex: 1 1 100%;
    }

    .dashboard-body .topbar-username {
        max-width: min(60vw, 250px);
    }

    .dashboard-settings-button {
        margin-left: auto;
    }

    .dashboard-body .topbar-actions {
        width: 100%;
    }

    .dashboard-body .topbar-actions .topbar-button {
        flex: 1 1 0;
        min-width: 0;
    }

    .dashboard-body .dashboard-page {
        display: block;

        height: auto;
        min-height: 100dvh;

        padding:
            calc(112px + env(safe-area-inset-top) + 12px)
            max(12px, env(safe-area-inset-right))
            max(24px, env(safe-area-inset-bottom))
            max(12px, env(safe-area-inset-left));

        overflow: visible;
    }

    .dashboard-room-panel {
        padding: 15px;
    }

    .dashboard-detail-panel {
        display: none;
    }

    .dashboard-body .room-list {
        flex: none;
    }

    .dashboard-body .room-selector {
        align-items: flex-start;
        padding-top: 16px;
    }
}


/*
 * If a desktop viewport becomes very short because of
 * zoom or window resizing, controls must remain reachable.
 */
@media (min-width: 768px) and (max-height: 570px) {
    .dashboard-body {
        overflow-y: auto;
    }

    .dashboard-body .dashboard-page {
        height: auto;
        min-height: 570px;
        overflow: visible;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-body .topbar-button {
        transition: none;
    }
}