/* CampusOS event-ready layer (loaded last). */

/* --- Bug fixes --------------------------------------------------------- */
/* An unscoped `.sidebar{display:flex}` in campusos-refined.css made the
   settings panel cover the chat on phones. Only show it as the Profile tab. */
@media (max-width:760px){
  .sidebar:not(.campus-open){display:none!important}
}
/* Theme switch: a tidy round icon button everywhere. */
.campus-theme-toggle{min-width:42px!important;width:42px;height:42px;padding:0!important;border-radius:999px!important;display:inline-flex!important;align-items:center;justify-content:center}
.campus-theme-toggle .theme-label{display:none!important}
/* Real connection state. */
.sidebar .status[data-state="offline"] .dot{background:#e5484d;box-shadow:0 0 0 4px rgba(229,72,77,.12)}
.sidebar .status[data-state="offline"]{color:#c2410c;opacity:1}

/* --- Bottom bar: Home · Explore · ＋ · Inbox · Profile ------------------ */
@media (max-width:760px){
  .campus-bottom-nav.co-five{grid-template-columns:repeat(5,minmax(0,1fr))!important;align-items:center}
  .campus-bottom-nav [hidden]{display:none!important}
  .co-create-tab{border:0;background:transparent;display:grid;place-items:center;cursor:pointer;padding:0}
  .co-create-plus{width:46px;height:36px;border-radius:12px;display:grid;place-items:center;background:linear-gradient(135deg,#1d577c,#2b7aab);color:#fff;font:600 26px/1 'Manrope',system-ui,sans-serif;box-shadow:0 6px 16px rgba(29,87,124,.28)}
  .co-create-tab:active .co-create-plus{transform:scale(.94)}
  body[data-campus-theme="dark"] .co-create-plus{background:linear-gradient(135deg,#ef7d00,#ff9a22);color:#111}
  /* The Profile tab reads like a profile page, not a settings drawer. */
  .sidebar.campus-open{animation:co-slide .22s cubic-bezier(.2,.8,.2,1)}
}
@keyframes co-slide{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* --- Create sheet & dialogs --------------------------------------------- */
.co-sheet{position:fixed;inset:0;z-index:60;display:flex;align-items:flex-end;justify-content:center;background:rgba(10,20,30,0);transition:background .18s}
.co-sheet.is-open{background:rgba(10,20,30,.42)}
.co-sheet[hidden]{display:none}
.co-sheet-panel{width:min(520px,100%);background:var(--panel-solid,#fff);color:#172b3c;border-radius:24px 24px 0 0;padding:10px 20px calc(18px + env(safe-area-inset-bottom));box-shadow:0 -20px 60px rgba(0,0,0,.18);transform:translateY(100%);transition:transform .22s cubic-bezier(.2,.8,.2,1);display:grid;gap:10px}
.co-sheet.is-open .co-sheet-panel{transform:none}
@media (min-width:761px){.co-sheet{align-items:center}.co-sheet-panel{border-radius:24px;padding:22px 24px}}
.co-sheet-grip{width:40px;height:5px;border-radius:9px;background:#d4dee7;margin:0 auto 4px}
.co-sheet-panel h2{margin:4px 0 0;font:800 21px 'Manrope',system-ui,sans-serif;letter-spacing:-.02em}
.co-sheet-sub{margin:0;color:#61778b;font-size:13px;line-height:1.5}
.co-sheet-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:6px}
.co-sheet-choice{display:grid;gap:3px;justify-items:start;text-align:left;padding:14px;border-radius:16px;border:1px solid #dde7ef;background:#f5f9fc;color:#172b3c;cursor:pointer;font:inherit}
.co-sheet-choice:hover{border-color:#8fb6d0;background:#eef5fa}
.co-sheet-choice strong{font-size:14px}
.co-sheet-choice>span:last-child{font-size:12px;color:#61778b;line-height:1.35}
.co-sheet-icon{font-size:22px;line-height:1;margin-bottom:4px}
.co-sheet-cancel{border:0;background:transparent;color:#61778b;font:600 14px inherit;padding:12px;cursor:pointer}
.co-input{width:100%;padding:13px 14px;border-radius:12px;border:1px solid #cfdbe5;background:#fff;color:#172b3c;font-size:16px}
.co-primary{border:0;border-radius:14px;padding:14px;font:700 14px inherit;background:#1d577c;color:#fff;cursor:pointer}
.co-primary:disabled{opacity:.6}
.co-danger-fill{background:#d23b3b}
.co-error{margin:0;color:#c0392b;font-size:13px;min-height:1em}
body[data-campus-theme="dark"] .co-sheet-panel{background:#161d25;color:#eef3f8}
body[data-campus-theme="dark"] .co-sheet-choice{background:#1d2631;border-color:#2c3946;color:#eef3f8}
body[data-campus-theme="dark"] .co-sheet-sub,body[data-campus-theme="dark"] .co-sheet-choice>span:last-child{color:#9fb0c0}
body[data-campus-theme="dark"] .co-input{background:#0f141a;border-color:#2c3946;color:#eef3f8}

/* --- Privacy & data ------------------------------------------------------ */
.co-privacy .campus-ui-profile-body{gap:6px}
.co-privacy-note{margin:0 0 6px;font-size:12px;line-height:1.5;color:var(--muted,#61778b)}
.co-row{display:flex;align-items:center;justify-content:space-between;width:100%;text-align:left;padding:11px 12px;border-radius:12px;border:1px solid transparent;background:transparent;color:inherit;font:600 13px inherit;cursor:pointer}
.co-row::after{content:"›";opacity:.45;font-size:18px;line-height:1}
.co-row:hover{background:rgba(29,87,124,.07)}
.co-row[hidden]{display:none}
.co-danger{color:#d23b3b}
.co-legal-links{margin:8px 0 0;font-size:12px;color:var(--muted,#61778b)}
.co-legal-links a,.campus-auth-footnote a{color:inherit;text-decoration:underline}

/* --- Skeleton loading ---------------------------------------------------- */
.co-loading{color:transparent!important;position:relative;min-height:240px;display:block!important}
.co-loading>*{visibility:hidden}
.co-loading::before{content:"";position:absolute;inset:0;border-radius:18px;
  background:
    linear-gradient(90deg,rgba(255,255,255,0) 0,rgba(255,255,255,.55) 50%,rgba(255,255,255,0) 100%) -150% 0/60% 100% no-repeat,
    linear-gradient(#e3ecf3 0 0) 0 0/100% 70px no-repeat,
    linear-gradient(#e3ecf3 0 0) 0 85px/100% 70px no-repeat,
    linear-gradient(#e3ecf3 0 0) 0 170px/100% 70px no-repeat;
  animation:co-shimmer 1.2s infinite}
body[data-campus-theme="dark"] .co-loading::before{background:
    linear-gradient(90deg,rgba(255,255,255,0) 0,rgba(255,255,255,.06) 50%,rgba(255,255,255,0) 100%) -150% 0/60% 100% no-repeat,
    linear-gradient(#1d2631 0 0) 0 0/100% 70px no-repeat,
    linear-gradient(#1d2631 0 0) 0 85px/100% 70px no-repeat,
    linear-gradient(#1d2631 0 0) 0 170px/100% 70px no-repeat}
@keyframes co-shimmer{to{background-position:250% 0,0 0,0 85px,0 170px}}

/* --- Toast --------------------------------------------------------------- */
.co-toast{position:fixed;left:50%;bottom:calc(90px + env(safe-area-inset-bottom));transform:translate(-50%,20px);opacity:0;z-index:70;background:#172b3c;color:#fff;padding:11px 16px;border-radius:999px;font-size:13px;font-weight:600;transition:.2s;pointer-events:none;box-shadow:0 10px 30px rgba(0,0,0,.2)}
.co-toast.is-visible{opacity:1;transform:translate(-50%,0)}

@media (prefers-reduced-motion:reduce){.co-sheet-panel,.co-sheet,.co-toast{transition:none}.co-loading::before,.sidebar.campus-open{animation:none}}

/* --- Header polish ------------------------------------------------------- */
@media (max-width:760px){
  .topbar .campus-brand-mobile{height:auto!important;overflow:visible!important}
  .topbar .campus-brand-mobile strong{flex:none!important;overflow:visible!important;display:block!important;font:800 19px/1.1 'Manrope',system-ui,sans-serif!important;color:#172b3c;opacity:1!important;visibility:visible!important}
  .topbar .campus-brand-mobile small{display:none!important}
  body[data-campus-theme="dark"] .topbar .campus-brand-mobile strong{color:#eef3f8}
}
/* "New chat" uses a compose icon, so it is not confused with the ＋ create button. */
.top-actions #clear::after{content:""!important;width:20px;height:20px;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E") center/contain no-repeat}
/* Feed refresh button showed as an empty square. */
.campus-explore-view .community-refresh{font-size:19px!important;line-height:1!important}
.campus-explore-view .community-refresh span{display:none!important}
/* Profile tab: hide the empty "Discover & share" label left over on phones. */
@media (max-width:760px){.sidebar.campus-open .section-title{display:none!important}}

/* --- OTHawKI hand-over button in chat ------------------------------------ */
.campus-referral{display:inline-flex;align-items:center;gap:6px;margin-top:12px;padding:10px 16px;border-radius:999px;background:#1d577c;color:#fff!important;text-decoration:none!important;font-weight:700;font-size:13px;white-space:nowrap;unicode-bidi:isolate;direction:ltr}
.campus-referral:hover{background:#174866}
body[data-campus-theme="dark"] .campus-referral{background:#ef7d00;color:#111!important}
