/* ═══════════════════════════════════════════════════════════
   RTN — Routine Tab Bar, Calendar & Stats Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Flat tab bar ── */
.rtn-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1.5px solid rgba(255,255,255,0.1);
    margin-bottom: 14px;
}
.rtn-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    color: rgba(255,255,255,0.45);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 4px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -1.5px;
    letter-spacing: 0.2px;
    font-family: inherit;
    text-align: center;
}
.rtn-tab:hover {
    color: rgba(255,255,255,0.8);
}
.rtn-tab-active {
    color: #fff;
    border-bottom-color: #86efac;
}
/* First tab: coach dropdown wrapper */
.rtn-ctx-tab {
    position: relative;
    padding: 0;
}
.rtn-tab-label {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 10px 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    box-sizing: border-box;
    color: inherit;
    text-align: center;
    margin-bottom: -1.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rtn-add-lib-btn {
    display: block;
    width: 100%;
    background: transparent;
    border: 1.5px dashed rgba(255,255,255,0.15);
    border-radius: 10px;
    color: rgba(255,255,255,0.4);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px;
    cursor: pointer;
    margin-bottom: 10px;
    font-family: inherit;
    transition: border-color .15s, color .15s;
}
.rtn-add-lib-btn:hover { border-color: rgba(255,255,255,0.28); color: rgba(255,255,255,0.65); }

.rtn-ctx-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    z-index: 9200;
    background: #1e2040;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.45);
    padding: 6px;
}

/* ── Calendar ── */
.rtn-cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 10px;
}
.rtn-arrow {
    background: rgba(255,255,255,0.08);
    border: none;
    color: #fff;
    font-size: 22px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.18s;
}
.rtn-arrow:hover { background: rgba(255,255,255,0.18); }
.rtn-cal-month-label {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    min-width: 140px;
    text-align: center;
}
.rtn-cal-dow-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 4px;
}
.rtn-cal-dow-row span {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rtn-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 12px;
}
.rtn-cal-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: opacity 0.15s;
    gap: 2px;
}
.rtn-cal-cell:hover { opacity: 0.8; }
.rtn-cal-empty  { pointer-events: none; }
.rtn-cal-today  { box-shadow: 0 0 0 2px rgba(255,255,255,0.5); color: #fff; }

/* Completion tiers */
.rtn-cal-none    { background: rgba(255,255,255,0.04); }
.rtn-cal-partial { background: rgba(34,197,94,0.15); color: #86efac; }
.rtn-cal-good    { background: rgba(34,197,94,0.35); color: #4ade80; }
.rtn-cal-done    { background: rgba(34,197,94,0.65); color: #fff; }

.rtn-cal-pct {
    font-size: 8px;
    opacity: 0.75;
    line-height: 1;
}

/* Legend */
.rtn-cal-legend {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 4px;
    margin-bottom: 8px;
}
.rtn-leg {
    font-size: 11px;
    font-weight: 600;
    padding-left: 14px;
    position: relative;
}
.rtn-leg::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border-radius: 3px;
}
.rtn-leg-none    { color: rgba(255,255,255,0.3); }
.rtn-leg-none::before    { background: rgba(255,255,255,0.06); }
.rtn-leg-partial { color: #86efac; }
.rtn-leg-partial::before { background: rgba(34,197,94,0.2); }
.rtn-leg-good    { color: #4ade80; }
.rtn-leg-good::before    { background: rgba(34,197,94,0.45); }
.rtn-leg-done    { color: #fff; }
.rtn-leg-done::before    { background: rgba(34,197,94,0.75); }

/* ── Stats ── */
.rtn-stat-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}
.rtn-stat-card {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 16px 12px;
    text-align: center;
}
.rtn-stat-val {
    font-size: 28px;
    font-weight: 900;
    color: #22c55e;
    line-height: 1.1;
}
.rtn-stat-lbl {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

/* ══════════════════════════════════════════
   Moment Log Sheet
   ══════════════════════════════════════════ */
.rtn-moment-sheet,
.rtn-day-sheet {
    position: fixed;
    inset: 0;
    z-index: 9100;
    display: flex;
    align-items: flex-end;
    animation: rtn-sheet-in 0.22s ease;
}
@keyframes rtn-sheet-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.rtn-moment-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
}
.rtn-moment-panel,
.rtn-day-panel {
    position: relative;
    width: 100%;
    background: #12142a;
    border-radius: 22px 22px 0 0;
    max-height: 88vh;
    overflow-y: auto;
    padding-bottom: calc(max(env(safe-area-inset-bottom, 0px), 8px) + 100px);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
    animation: rtn-panel-up 0.24s cubic-bezier(0.32,0.72,0,1);
}
@keyframes rtn-panel-up {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.rtn-moment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.rtn-moment-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}
.rtn-moment-close {
    background: rgba(255,255,255,0.08);
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.rtn-moment-close:hover { background: rgba(255,255,255,0.15); }

/* Image picker area */
.rtn-moment-img-area {
    margin: 14px 16px 0;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    border: 1.5px dashed rgba(255,255,255,0.15);
    min-height: 130px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.18s, background 0.18s;
}
.rtn-moment-img-area:hover { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.05); }
.rtn-moment-img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: rgba(255,255,255,0.35);
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
}
.rtn-moment-img-icon { font-size: 30px; line-height: 1; }
.rtn-moment-img-preview {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
}
.rtn-moment-img-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.65);
    border: none;
    color: #fff;
    font-size: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Text input */
.rtn-moment-text {
    display: block;
    width: calc(100% - 32px);
    margin: 12px 16px 0;
    padding: 12px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    transition: border-color 0.18s;
    box-sizing: border-box;
}
.rtn-moment-text:focus { outline: none; border-color: rgba(34,197,94,0.5); }
.rtn-moment-text::placeholder { color: rgba(255,255,255,0.28); }

/* Mood picker */
.rtn-mood-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 0;
}
.rtn-mood-picker-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.rtn-mood-emojis {
    display: flex;
    gap: 6px;
}
.rtn-mood-emoji {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    font-size: 22px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
    padding: 0;
}
.rtn-mood-emoji:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.22); }
.rtn-mood-emoji.rtn-mood-selected {
    background: rgba(34,197,94,0.18);
    border-color: #22c55e;
    transform: scale(1.15);
}

/* Action buttons */
.rtn-moment-actions {
    display: flex;
    gap: 10px;
    padding: 14px 16px 4px;
}
.rtn-moment-ai-btn {
    flex: 1;
    padding: 13px;
    border-radius: 12px;
    background: rgba(155,109,255,0.14);
    border: 1.5px solid rgba(155,109,255,0.3);
    color: #9b6dff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
}
.rtn-moment-ai-btn:hover { background: rgba(155,109,255,0.24); }
.rtn-moment-ai-btn.rtn-ai-busy { animation: rtn-pulse 1s infinite; pointer-events: none; }
.rtn-moment-save-btn {
    flex: 2;
    padding: 13px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(34,197,94,0.9), rgba(16,185,129,0.9));
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.18s;
}
.rtn-moment-save-btn:disabled,
.rtn-moment-ai-btn:disabled { opacity: 0.45; pointer-events: none; }
@keyframes rtn-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ── Routine match section (shown after AI analysis) ── */
.rtn-match-header {
    font-size: 0.78rem;
    font-weight: 700;
    color: #86efac;
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}
.rtn-match-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rtn-match-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(134,239,172,0.07);
    border: 1px solid rgba(134,239,172,0.20);
    border-radius: 12px;
    padding: 10px 12px;
}
.rtn-match-icon { font-size: 1.1rem; flex-shrink: 0; }
.rtn-match-title {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.88);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rtn-match-done-label { color: rgba(134,239,172,0.70); font-style: italic; }
.rtn-match-done-btn {
    flex-shrink: 0;
    background: rgba(134,239,172,0.15);
    border: 1px solid rgba(134,239,172,0.30);
    color: #86efac;
    font-size: 0.74rem;
    font-weight: 700;
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.rtn-match-done-btn:hover { background: rgba(134,239,172,0.28); }
.rtn-match-skip-btn {
    width: 100%;
    background: none;
    border: none;
    color: rgba(255,255,255,0.30);
    font-size: 0.74rem;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 0;
    text-align: center;
    text-decoration: underline;
}
.rtn-match-skip-btn:hover { color: rgba(255,255,255,0.55); }

/* ── Today's Moments strip (inside daily tab) ── */
.rtn-today-moments { margin-top: 18px; }
.rtn-today-moments-hdr {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* ── Moment card (shared by today strip + day detail) ── */
.rtn-moment-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
}
.rtn-moment-card-img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    display: block;
}
.rtn-moment-card-body { padding: 12px 14px 10px; }
.rtn-moment-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #22c55e;
    margin-bottom: 4px;
}
.rtn-moment-card-note {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    line-height: 1.4;
}
.rtn-moment-card-summary {
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    margin-top: 6px;
    line-height: 1.4;
    font-style: italic;
}
.rtn-moment-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.rtn-moment-card-time {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
}
.rtn-moment-card-del {
    background: none;
    border: none;
    color: rgba(255,80,80,0.55);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: color 0.15s;
}
.rtn-moment-card-del:hover { color: rgba(255,80,80,0.9); }

/* ── Calendar day detail sheet ── */
.rtn-day-moments-list { padding: 14px 16px 8px; }
.rtn-day-empty {
    text-align: center;
    color: rgba(255,255,255,0.3);
    font-size: 13px;
    padding: 28px 0;
}

/* Calendar cell: moment camera badge */
.rtn-cal-cell { position: relative; }
.rtn-cal-cam {
    position: absolute;
    bottom: 3px;
    right: 3px;
    font-size: 8px;
    line-height: 1;
    pointer-events: none;
}
