/* ── Journal (jn) ── */

/* Shell */
.jn-shell {
    padding-top: 1rem;
    padding-bottom: 6rem;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Layout: single column on mobile, 2-panel on md+ */
.jn-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Header variants */
.jn-header {
    text-align: center;
    padding: 1.25rem 1rem 0.75rem;
}

.jn-header--desktop {
    display: none;
}

.jn-header--mobile {
    display: block;
}

/* ── Sidebar ── */
.jn-sidebar {
    width: 100%;
}

/* ── Main ── */
.jn-main {
    width: 100%;
    min-width: 0;
}

/* ── Desktop 2-panel ── */
@media (min-width: 768px) {
    .jn-shell {
        padding-top: 0;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .jn-layout {
        flex-direction: row;
        gap: 1.5rem;
        align-items: flex-start;
    }

    .jn-header--desktop {
        display: block;
        text-align: left;
        padding: 0.5rem 0 0.75rem;
    }

    .jn-header--mobile {
        display: none;
    }

    .jn-sidebar {
        width: 340px;
        min-width: 340px;
        max-width: 340px;
        position: sticky;
        top: 5rem;
        align-self: flex-start;
    }

    .jn-main {
        flex: 1;
        min-width: 0;
    }

    .jn-filters {
        justify-content: flex-start;
    }
}

@media (min-width: 992px) {
    .jn-shell {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .jn-sidebar {
        width: 370px;
        min-width: 370px;
        max-width: 370px;
    }
}

/* ── Stats strip ── */
.jn-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.jn-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.25rem;
    border-radius: 1.25rem;
    text-align: center;
    transition: transform 0.2s ease;
}

.jn-stat-card:hover {
    transform: translateY(-2px);
}

.jn-stat-icon {
    font-size: 1rem;
    margin-bottom: 0.15rem;
    opacity: 0.7;
}

.jn-stat-icon--active {
    color: rgba(76, 118, 255, 0.8);
}

.jn-stat-icon--positive {
    color: rgba(80, 220, 140, 0.8);
}

.jn-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--body-color);
}

.jn-stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--body-color-faded);
    margin-top: 0.1rem;
}

@media (max-width: 400px) {
    .jn-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .jn-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.45rem;
    }
    .jn-stat-card {
        padding: 0.6rem 0.2rem;
    }
    .jn-stat-value {
        font-size: 1.15rem;
    }
}

/* ── Calendar ── */
.jn-calendar {
    margin-bottom: 1.25rem;
}

.jn-calendar-inner {
    padding: 1rem;
}

/* Calendar ring indicators (right arc = positive, left arc = negative) */
.jn-calendar .calendar-day {
    position: relative;
}

.jn-date-num {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    width: 100%;
    height: 100%;
    text-align: center;
}

.jn-calendar .calendar-day .jn-cal-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.jn-cal-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    mask: radial-gradient(transparent 63%, black 55%);
    -webkit-mask: radial-gradient(transparent 63%, black 55%);
}

/* background is set inline per-day via PHP (conic-gradient based on active dream average) */

/* Legend */
.jn-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.6rem;
}

.jn-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    color: var(--body-color-faded);
}

/* background set inline; mask punches center to make a ring */
.jn-legend-ring {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    flex-shrink: 0;
    mask: radial-gradient(transparent 52%, black 53%);
    -webkit-mask: radial-gradient(transparent 52%, black 53%);
}

/* ── Filter tabs overrides ── */
.jn-filters {
    justify-content: center;
    margin-bottom: 0.5rem;
}

/* ── Entry feed ── */
.jn-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Date group */
.jn-date-group {
    margin-bottom: 0.25rem;
}

.jn-date-separator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.jn-date-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--body-color-faded);
    white-space: nowrap;
    flex-shrink: 0;
}

.jn-date-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--generic-accent-color-rgb), 0.2), transparent);
}

/* Desktop: entries in a 2-col grid within each date group */
@media (min-width: 768px) {
    .jn-date-group {
        margin-bottom: 0.5rem;
    }

    .jn-date-group-entries {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .jn-entry {
        margin-bottom: 0;
    }

    .jn-entry-inner {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .jn-entry-inner .jn-progress {
        margin-top: auto;
    }
}

/* ── Entry card ── */
.jn-entry {
    margin-bottom: 0.6rem;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.jn-entry:active {
    transform: scale(0.985);
}

.jn-entry--done {
    opacity: 0.45;
}

.jn-entry-inner {
    padding: 0.85rem 1rem;
    border-radius: 1.25rem;
    background: linear-gradient(
        90deg,
        var(--gradient-color-1) 0%,
        var(--gradient-color-2) 80%,
        var(--gradient-color-3) 100%
    );
    border: 1px solid var(--navbar-border-bottom);
    position: relative;
    overflow: hidden;
}

/* Sentiment left accent */
.jn-entry--positive .jn-entry-inner {
    border-left: 3px solid var(--dream-positive-border-color);
}

.jn-entry--neutral .jn-entry-inner {
    border-left: 3px solid var(--dream-neutral-border-color);
}

.jn-entry--negative .jn-entry-inner {
    border-left: 3px solid var(--dream-negative-border-color);
}

/* Tremble inner: tighter, no bottom padding gap */
.jn-entry-inner--tremble {
    padding-bottom: 0.65rem;
}

.jn-entry-inner--tremble .jn-entry-dates {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.63rem;
    color: var(--body-color-faded);
}

/* Entry header row */
.jn-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.jn-entry-type {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.jn-type--dream {
    color: rgba(76, 118, 255, 0.75);
}

.jn-type--tremble {
    color: rgba(255, 80, 255, 0.75);
}

.jn-entry-sentiment {
    font-size: 0.6rem;
    color: var(--body-color-faded);
}

/* Title */
.jn-entry-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--heading-color-1);
    margin: 0 0 0.15rem;
    line-height: 1.3;
}

/* Description */
.jn-entry-desc {
    font-size: 0.78rem;
    color: var(--text-dream-color);
    margin: 0 0 0.35rem;
    border-top: 1px solid rgba(var(--generic-accent-color-rgb), 0.08);
    padding-top: 0.3rem;
    line-height: 1.4;
}

/* Meta row */
.jn-entry-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.jn-entry-dates {
    font-size: 0.65rem;
    color: var(--body-color-faded);
}

.jn-entry-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    border: none;
    line-height: 1.4;
}

.jn-entry-badge--done {
    background: rgba(76, 118, 255, 0.1);
    color: rgba(76, 118, 255, 0.7);
}

.jn-entry-badge--mark {
    background: rgba(var(--generic-accent-color-rgb), 0.08);
    color: var(--body-color-faded);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.jn-entry-badge--mark:hover {
    background: rgba(var(--generic-accent-color-rgb), 0.2);
    color: var(--body-color);
}

/* Progress bar */
.jn-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jn-progress-track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--shadow-dark-alpha-25);
    overflow: hidden;
}

.jn-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.jn-progress-label {
    font-size: 0.6rem;
    color: var(--body-color-faded);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── FAB ── */
.jn-fab {
    position: fixed;
    bottom: 5.5rem;
    right: 1.25rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    background: linear-gradient(135deg, rgba(80, 80, 255, 0.8), rgba(221, 80, 170, 0.8));
    color: #fff;
    box-shadow:
        0 4px 16px rgba(80, 80, 255, 0.25),
        0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.jn-fab:hover {
    transform: scale(1.08);
    box-shadow:
        0 6px 24px rgba(80, 80, 255, 0.35),
        0 3px 8px rgba(0, 0, 0, 0.4);
}

.jn-fab:active {
    transform: scale(0.95);
}

@media (min-width: 768px) {
    .jn-fab {
        bottom: 2rem;
        right: 2rem;
        width: 56px;
        height: 56px;
    }
}

/* ── Bottom sheet ── */
.jn-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1060;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.jn-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.jn-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1070;
    background: var(--navbar-bg, #151515);
    border-top: 1px solid rgba(var(--generic-accent-color-rgb), 0.15);
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 0.75rem 1.25rem 2rem;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    max-height: 85vh;
    overflow-y: auto;
}

.jn-sheet.open {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .jn-sheet {
        left: 50%;
        right: auto;
        width: 480px;
        transform: translate(-50%, 100%);
        border-radius: 1.5rem 1.5rem 0 0;
    }
    .jn-sheet.open {
        transform: translate(-50%, 0);
    }
}

.jn-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(var(--generic-accent-color-rgb), 0.25);
    margin: 0 auto 0.75rem;
}

/* ── Form elements ── */
.jn-sheet-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.jn-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.jn-field-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--body-color-faded);
}

.jn-input {
    background: var(--input-bg, rgba(255, 255, 255, 0.1));
    border: 1px solid var(--input-border, rgba(255, 255, 255, 0.2));
    border-radius: 0.85rem;
    color: var(--input-color, #fff);
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.jn-input:focus {
    border-color: rgba(var(--generic-accent-color-rgb), 0.4);
    box-shadow: 0 0 0 3px rgba(var(--generic-accent-shadow-rgb), 0.08);
}

.jn-input::placeholder {
    color: var(--input-placeholder-color, rgba(255, 255, 255, 0.45));
}

.jn-textarea {
    resize: none;
    min-height: 70px;
}

.jn-field-row {
    display: flex;
    gap: 0.75rem;
}

.jn-field--half {
    flex: 1;
}

/* Toggle group */
.jn-toggle-group {
    display: flex;
    gap: 0.4rem;
}

.jn-toggle {
    flex: 1;
    padding: 0.45rem 0.6rem;
    border-radius: 0.85rem;
    border: 1px solid var(--horoscope-tab-nav-link-border, #353535);
    background: transparent;
    color: var(--body-color-faded);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.jn-toggle.active {
    border-color: rgba(var(--generic-accent-color-rgb), 0.4);
    background: rgba(var(--generic-accent-color-rgb), 0.08);
    color: var(--body-color);
}

/* Sentiment picker */
.jn-sentiment-pick {
    display: flex;
    gap: 0.4rem;
}

.jn-sentiment-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 2px solid transparent;
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jn-sentiment-btn.active {
    border-color: rgba(var(--generic-accent-color-rgb), 0.5);
    background: rgba(var(--generic-accent-color-rgb), 0.1);
    transform: scale(1.15);
}

/* Submit button */
.jn-submit {
    width: 100%;
    padding: 0.7rem;
    border: none;
    border-radius: 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(
        90deg,
        rgba(80, 80, 255, 0.6) 0%,
        rgba(255, 80, 255, 0.6) 50%,
        rgba(221, 80, 170, 0.6) 100%
    );
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.jn-submit:hover {
    opacity: 0.9;
}

.jn-submit:active {
    transform: scale(0.98);
}
