/* =========================================================
   MentorLift — stylesheet
   Mobile-first, light luxury (gold accent)
   ========================================================= */

:root {
    --bg-main: #F8F9FA;
    --bg-card: #FFFFFF;
    --bg-soft: #FCFBF7;
    --text-main: #1A1A1A;
    --text-muted: #6C757D;
    --accent: #D4AF37;
    --accent-deep: #B59018;
    --border: #E9ECEF;
    --gradient: linear-gradient(135deg, #D4AF37 0%, #F8F1D2 50%, #B59018 100%);
    --gradient-soft: linear-gradient(135deg, rgba(212,175,55,.12) 0%, rgba(248,241,210,.18) 100%);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.08);
    --radius: 16px;
    --success: #22c55e;
    --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

html { background: var(--bg-card); overscroll-behavior-y: none; }
body {
    background: var(--bg-main);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
    line-height: 1.5;
}

body.app-body {
    padding-top: 70px;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

img { max-width:100%; display:block; }
a { color: var(--text-main); text-decoration: none; }
a.link { color: var(--accent-deep); text-decoration: underline; }

/* ============== Top Bar ============== */
.top-bar {
    position: fixed; top: 0; left: 0; width: 100%; height: 70px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,.02);
}
.top-bar-title { font-weight: 800; font-size: 1.2rem; letter-spacing: -.5px; display:flex; align-items:center; gap:8px; }
.top-bar-title .logo-mark {
    width: 28px; height: 28px; border-radius: 8px;
    background: var(--gradient);
    display: inline-flex; align-items:center; justify-content:center;
    color:#000; font-size:.8rem; box-shadow:0 2px 8px rgba(212,175,55,.4);
}
.top-bar-icons { display: flex; gap: 20px; font-size: 1.2rem; align-items: center; }
.top-bar-icons a {
    position: relative; color: var(--text-main); transition: .25s;
    display: inline-flex; align-items: center; justify-content: center;
}
.top-bar-icons a:hover { color: var(--accent-deep); }
.icon-badge {
    position: absolute; top: -6px; right: -8px;
    background: var(--danger); color: #fff;
    font-size: .6rem; font-weight: 800;
    min-width: 18px; height: 18px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    padding: 0 4px; border: 2px solid var(--bg-card);
}

/* ============== Container ============== */
/* ============================================================
   Layout — body padding to clear the fixed footer nav
   ============================================================ */
body.app-body {
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

.container { max-width: 800px; margin: 0 auto; padding: 20px; }
.container.narrow { max-width: 540px; }

/* ============== Program header ============== */
.program-header { text-align: center; margin-bottom: 28px; margin-top: 10px; }
.program-title {
    font-size: 2.2rem; font-weight: 800; color: var(--text-main);
    margin-bottom: 5px; line-height: 1.15; letter-spacing: -.5px;
}
.program-author {
    font-size: 1rem; color: var(--text-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
}

/* ============== Progress ============== */
.progress-container {
    background: var(--bg-card); padding: 20px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 20px; border: 1px solid var(--border);
}
.progress-header {
    display: flex; justify-content: space-between;
    margin-bottom: 10px; font-weight: 600; font-size: .9rem;
}
.progress-track { width: 100%; height: 8px; background: var(--border); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient); border-radius: 10px; transition: width .8s ease; }

/* ============== Days nav (pill scroller) ============== */
.days-nav {
    display: flex; gap: 10px; overflow-x: auto;
    padding-bottom: 10px; margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.days-nav::-webkit-scrollbar { display: none; }
.day-pill {
    flex-shrink: 0; padding: 10px 18px; border-radius: 50px;
    font-size: .9rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-muted); box-shadow: var(--shadow);
    cursor: pointer; transition: .2s;
}
.day-pill.active   { background: var(--gradient); color: #000; border-color: transparent; }
.day-pill.locked   { opacity: .55; cursor: not-allowed; }
.day-pill.completed{ background: rgba(34,197,94,.1); color: #15803d; border-color: rgba(34,197,94,.3); }

/* ============== Card ============== */
.content-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 20px;
    transition: all .3s ease;
}
.image-wrapper {
    background: #E9ECEF;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: center; align-items: center;
    overflow: hidden;
}
.hero-img { width: 100%; max-height: 450px; object-fit: cover; }
.image-placeholder {
    width: 100%; aspect-ratio: 16/10;
    background: var(--gradient-soft);
    display:flex; align-items:center; justify-content:center;
    color: var(--accent-deep); font-size: 3rem;
}
.card-body { padding: 28px; }
.card-body h2 { font-size: 1.4rem; margin-bottom: 12px; font-weight: 800; letter-spacing: -.3px;}
.card-body p { color: var(--text-muted); line-height: 1.6; margin-bottom: 18px; }

/* ============== Audio player box ============== */
.audio-player-box {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; gap: 8px;
}
.btn-play-audio {
    width: 50px; height: 50px; border-radius: 50%;
    background: var(--gradient); border: none; color: #000;
    font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(212,175,55,.3);
    transition: .2s;
}
.btn-play-audio:hover { transform: scale(1.05); }
.audio-info { flex-grow: 1; padding: 0 12px; min-width:0; }
.audio-title { font-weight: 600; font-size: 1rem; color: var(--text-main); }
.audio-sub   { font-size: .8rem; color: var(--text-muted); }
.btn-text {
    background: none; border: none; color: var(--accent-deep);
    font-weight: 600; cursor: pointer; font-size: .9rem;
    text-decoration: underline; flex-shrink: 0;
}

/* ============== Action / Form ============== */
.action-item {
    background: rgba(212,175,55,0.06);
    border-left: 4px solid var(--accent);
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.5;
}
textarea, input[type=text], input[type=email], input[type=password], select {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
    transition: .2s;
    font-family: 'Inter', sans-serif;
}
textarea { resize: vertical; min-height: 120px; margin-bottom: 12px; }
textarea:focus, input:focus, select:focus {
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(212,175,55,.1);
}

label { display:block; font-weight:600; font-size:.9rem; margin-bottom:8px; color:var(--text-main); }
.field { margin-bottom: 16px; }

/* ============== Buttons ============== */
.btn {
    padding: 14px 24px; border-radius: 50px;
    font-weight: 600; cursor: pointer; text-align: center;
    display: inline-flex; align-items:center; justify-content:center; gap:8px;
    transition: .2s; border: none; font-size: .95rem;
    font-family: 'Inter', sans-serif;
}
.btn-primary {
    background: var(--gradient); color: #000; width: 100%;
    box-shadow: 0 4px 15px rgba(212,175,55,.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212,175,55,.4); }
.btn-secondary {
    background: var(--bg-main); color: var(--text-main);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background:transparent; color:var(--accent-deep); }
.btn-danger { background:var(--danger); color:#fff; }
.btn-block { width:100%; }
.button-group { display: flex; gap: 12px; margin-top: 10px; }
.button-group .btn { flex: 1; }

/* ============== Hidden flow sections ============== */
#journal-section, #completion-section { display: none; }

/* ============== Footer app menu ============== */
.app-footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(75px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 -2px 14px rgba(0,0,0,.04);
}
.app-footer-inner {
    max-width: 640px; margin: 0 auto; height: 75px;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items:center;
}
.foot-item {
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:4px; color: var(--text-muted); font-size:.68rem; font-weight:600;
    text-decoration:none; padding:8px 4px; height:100%;
    position: relative; transition: color .2s;
    overflow: hidden;
}
.foot-item i { font-size: 1.2rem; }
.foot-item span { white-space: nowrap; }
.foot-item.active { color: var(--accent-deep); }
.foot-item.active::before {
    content: ''; position:absolute; top:0; left:50%; transform:translateX(-50%);
    width: 30px; height:3px; background: var(--gradient); border-radius: 0 0 4px 4px;
}
.foot-item.center {
    background: var(--gradient); color:#000;
    border-radius: 50%; width:54px; height:54px;
    align-self:center; justify-self:center;
    box-shadow: 0 6px 18px rgba(212,175,55,.4);
}
.foot-item.center span { display:none; }
.foot-item.center i { font-size: 1.35rem; }
.foot-item.center::before { display:none; }
.foot-item.center.active { color:#000; }

/* ============== Modal ============== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(5px);
    z-index: 6000; justify-content: center; align-items: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-content {
    background: var(--bg-card); border-radius: var(--radius);
    width: 100%; max-width: 500px; padding: 28px;
    position: relative;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    max-height: 90vh; overflow-y: auto;
}
.modal-close {
    position: absolute; top: 15px; right: 20px;
    background: none; border: none; color: var(--text-muted);
    font-size: 1.5rem; cursor: pointer; line-height: 1;
}
.modal-content h2 { font-size: 1.3rem; margin-bottom: 16px; }

/* ============== Auth screens ============== */
.auth-wrap {
    min-height: 100dvh;
    display: flex; flex-direction: column; align-items: center;
    padding: 60px 20px;
    background:
      radial-gradient(circle at top right, rgba(212,175,55,.15), transparent 50%),
      radial-gradient(circle at bottom left, rgba(248,241,210,.3), transparent 50%),
      var(--bg-main);
}
.auth-logo {
    display:flex; align-items:center; gap:10px;
    font-size: 1.8rem; font-weight: 800; letter-spacing: -.5px;
    margin-bottom: 28px;
}
.auth-logo .logo-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 1rem; }
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 1.6rem; font-weight:800; margin-bottom: 4px; letter-spacing: -.3px;}
.auth-card .sub { color: var(--text-muted); margin-bottom: 22px; font-size: .95rem;}
.auth-switch { text-align:center; margin-top: 20px; font-size:.9rem; color:var(--text-muted); }
.auth-switch a { color: var(--accent-deep); font-weight: 600; }

/* ============== Lists (history, messages, users) ============== */
.list-card {
    background: var(--bg-card); border:1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px;
    padding: 18px 20px; display:flex; align-items:center; gap:14px;
    transition: .2s; cursor: pointer;
}
.list-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.list-card .icon-circ {
    flex-shrink:0; width:44px; height:44px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    background: var(--gradient-soft); color:var(--accent-deep); font-size: 1rem;
}
.list-card.done .icon-circ { background: rgba(34,197,94,.12); color:#15803d; }
.list-card .meta { flex-grow:1; min-width:0; }
.list-card .meta .t { font-weight:700; font-size:.98rem; }
.list-card .meta .s { color: var(--text-muted); font-size:.85rem; margin-top:2px;
    white-space: nowrap; overflow:hidden; text-overflow: ellipsis; }
.list-card .arrow { color: var(--text-muted); font-size:.9rem; }

.empty-state {
    text-align:center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity:.4; display:block; }
.empty-state h3 { color: var(--text-main); margin-bottom: 6px; font-size:1.1rem;}

/* ============== Tabs ============== */
.tabs { display:flex; gap:8px; background:var(--bg-card); padding:6px; border-radius:50px; border:1px solid var(--border); margin-bottom: 20px;}
.tab { flex:1; padding:10px 12px; text-align:center; border-radius:50px; font-weight:600; font-size:.85rem; color:var(--text-muted); cursor:pointer; transition:.2s; }
.tab.active { background: var(--gradient); color:#000; }

/* ============== Settings ============== */
.settings-section { margin-bottom: 28px; }
.settings-section h3 { font-size:.8rem; text-transform:uppercase; letter-spacing:1px; color:var(--text-muted); margin-bottom: 12px; font-weight: 700; padding-left: 4px;}
.settings-row {
    background: var(--bg-card); border:1px solid var(--border);
    padding: 16px 20px; display:flex; align-items:center; justify-content:space-between;
    gap: 12px;
}
.settings-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.settings-row:last-child  { border-radius: 0 0 var(--radius) var(--radius); }
.settings-row:only-child   { border-radius: var(--radius); }
.settings-row + .settings-row { border-top: 0; }
.settings-row .label { font-weight: 600; font-size: .95rem; }
.settings-row .sub   { color: var(--text-muted); font-size:.8rem; margin-top:2px; }

/* Toggle switch */
.switch { position: relative; width: 50px; height: 28px; flex-shrink:0;}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--border); border-radius: 28px; transition: .25s;
}
.slider::before {
    content: ''; position: absolute; height: 22px; width: 22px;
    left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .25s;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.switch input:checked + .slider { background: var(--gradient); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* Avatar */
.avatar { width:88px; height:88px; border-radius:50%; object-fit:cover; border:3px solid var(--bg-card); box-shadow: 0 4px 16px rgba(0,0,0,.08);}
.avatar-circle {
    width:88px; height:88px; border-radius:50%;
    background: var(--gradient); color:#000; font-weight:800;
    display:flex; align-items:center; justify-content:center; font-size: 2rem;
    box-shadow: 0 4px 16px rgba(212,175,55,.3);
}
.profile-head { text-align:center; padding: 14px 0 24px; }
.profile-head .name { font-size:1.3rem; font-weight:800; margin-top:14px;}
.profile-head .role { color:var(--text-muted); font-size:.85rem; text-transform:uppercase; letter-spacing:1px; margin-top: 2px;}

/* ============== Inbox preview row ============== */
.msg-row { gap: 14px; }
.msg-row.unread .meta .t::after {
    content: ''; display:inline-block; width:8px; height:8px;
    background: var(--accent); border-radius: 50%; margin-left: 6px;
    vertical-align: middle;
}
.msg-row .icon-circ { background: var(--gradient); color:#000; }

/* ============== Toast ============== */
.toast {
    position: fixed; bottom: calc(100px + env(safe-area-inset-bottom));
    left: 50%; transform: translateX(-50%);
    background: #1A1A1A; color: #fff; padding: 12px 20px; border-radius: 50px;
    font-size: .9rem; font-weight: 600; z-index: 9000;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
    opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
    display: flex; align-items:center; gap:8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.success { background: #15803d; }
.toast.error { background: var(--danger); }

/* ============== Coach / Admin tables ============== */
.data-table {
    width: 100%; border-collapse: collapse; background: var(--bg-card);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.data-table th, .data-table td {
    padding: 14px 16px; text-align: left; font-size:.9rem;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: var(--bg-soft); font-size:.75rem;
    text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted);
}
.data-table tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 50px; font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.5px; }
.badge.user  { background: rgba(212,175,55,.15); color: var(--accent-deep); }
.badge.coach { background: rgba(99,102,241,.15); color: #4f46e5; }
.badge.admin { background: rgba(239,68,68,.15); color: var(--danger); }
.badge.active   { background: rgba(34,197,94,.15); color: #15803d; }
.badge.paused   { background: rgba(245,158,11,.15); color: #b45309; }
.badge.completed{ background: rgba(99,102,241,.15); color: #4f46e5; }

/* Section header w action button */
.section-head { display:flex; justify-content:space-between; align-items:center; margin-bottom: 16px;}
.section-head h2 { font-size:1.4rem; font-weight:800; letter-spacing:-.3px;}
.section-head .btn { padding: 10px 18px; font-size:.85rem; width: auto;}

/* Responsive */
@media (max-width: 600px) {
    .audio-player-box { flex-direction: column; text-align: center; gap: 12px; }
    .audio-info { padding: 0; text-align: center; }
    .button-group { flex-direction: column; }
    .program-title { font-size: 1.7rem; }
    .card-body { padding: 22px; }
    .top-bar-title .label { display:none; }
}
@media (max-width: 480px) {
    .data-table th, .data-table td { padding: 10px 8px; font-size:.8rem; }
}

/* ============================================================
   Settings → More section rows
   ============================================================ */
.settings-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid #F1ECDD;
    text-decoration: none;
    color: var(--text);
    transition: background .15s;
}
.settings-row:last-child { border-bottom: 0; }
.settings-row:hover { background: rgba(212,175,55,.05); }
.settings-row-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(212,175,55,.12);
    color: #7A6018;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
}
.settings-row-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.settings-row-title { font-weight: 600; font-size: 15px; }
.settings-row-sub   { font-size: 12.5px; color: var(--text-muted); }

/* ============================================================
   Message detail view — body, video, image
   ============================================================ */
.msg-body {
    font-size: .98rem;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-wrap;
    margin: 8px 0 20px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.msg-video {
    display: block;
    width: 100%;
    max-height: 70vh;
    margin: 0 0 14px;
    background: #000;
    border-radius: 12px;
}
.msg-image {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    margin: 0 0 14px;
    border-radius: 12px;
    cursor: zoom-in;
    background: #f4f4f4;
}