/* ==========================================================================
   Furlders UI — Purple + Pink (CLEAN DROP-IN)
   Bootstrap-friendly; pairs with style.css
   Goals:
   - Single source of truth for tokens (no duplicate :root conflicts)
   - Fixed-header friendly (uses --header-h + body.has-fixed-header)
   - Consistent buttons (primary purple, accent pink, ghost + delete pills)
   - Safe defaults that won’t fight page-specific css
   ========================================================================== */

/* === Design tokens ======================================================= */
:root{
  /* Brand */
  --brand:       #FE4FB4;   /* primary pink */
  --brand-600:   #EC399F;   /* deeper pink */
  --ink:         #0F0E47;   /* dark inky purple for focus/borders */

  /* Purples (primary buttons / emphasis) */
  --primary-700: #2A2751;   /* brand purple */
  --primary-800: #211F40;   /* hover */
  --primary-900: #1B1936;   /* active */

  /* Surfaces / borders on colored backgrounds */
  --soft:   rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.18);

  /* Outline / pill palette */
  --btn-outline-border: #FFD3EC;
  --btn-outline-text:   #D73C93;
  --btn-outline-hover:  #FFC7E7;
  --btn-outline-bg:     #FFE8F5;

  /* Focus ring */
  --ring: rgba(254,79,180,.25);

  /* Typography */
  --font-sans: "Poppins", system-ui, -apple-system, Segoe UI, Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Pacifico", cursive;

  /* Layout */
  --radius: 12px;

  /* Header height (default; header-init.js should update) */
  --header-h: 64px;

  /* Page rhythm */
  --page-max: 1120px;
  --page-pad-x: 20px;
  --page-pad-y: 24px;

  /* Title underline */
  --active-underline: #FFB8DC;
  --title-underline-h: 4px;
  --title-underline-gap: 10px;

  /* Pill buttons */
  --btn-pill-radius: 9999px;
  --btn-pad-y: .35rem;
  --btn-pad-x: .8rem;
}

/* === Base / Global ======================================================= */
body{
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* If you set a fixed header, this keeps the whole page below it */
body.has-fixed-header{
  padding-top: var(--header-h);
}

.brand-title{
  font-family: var(--font-display);
  color: var(--brand);
}

/* Keep content below fixed header on EVERY page (if you use main.page-container) */
main.page-container{
  padding-top: 8px; /* body already has header padding; keep this small */
}

/* Links: inherit color; gentle hover tint */
a{ color: inherit; text-decoration-color: rgba(255,255,255,.35); }
a:hover{ color: var(--brand); }

/* Navbar active state */
.nav-link.active{ font-weight: 600; color: #FFB8DC !important; }

/* === Layout shell helpers =============================================== */
.page-wrap{
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--page-pad-y) var(--page-pad-x);
}

/* === Page title block (shared across pages) ============================== */
.page-head{
  margin: 6px 0 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.page-title{
  margin: 0;
  color: #fff;
  font-weight: 800;
  line-height: 1.15;
  font-size: clamp(22px, 3.2vw, 40px);
  position: relative;
}

.page-title::after{
  content:"";
  display:block;
  width:72px;
  height: var(--title-underline-h);
  border-radius:999px;
  margin: .5rem auto 0;
  background: linear-gradient(180deg, var(--brand), var(--brand-600));
}

.page-subtitle{
  color: rgba(255,255,255,.85);
  margin-top:.35rem;
  font-size: .98rem;
}

/* === Sections / Cards ==================================================== */
.section-soft{
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Bootstrap cards used as link cards */
.card.link-card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.12);
}

.card.link-card .card-title{ font-weight: 600; }

/* Ensure images render cleanly */
.folder-card img,
.card .card-img-top,
.card img{
  display:block;
  width:100%;
  height:auto;
  object-fit:cover;
  position:relative;
  z-index:2;
}

/* If any global pseudo-elements were messing with images/cards */
.card::before, .card::after,
.folder-card::before, .folder-card::after{ content:none !important; }

/* Optional “image band” helper */
.card .card-img-band{
  min-height:160px;
  background-size:cover;
  background-position:center;
}

/* Lightweight grid helpers (legacy link grids) */
.links-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap:14px;
}
.link-card{
  border:1px solid #e6e6e6;
  border-radius:12px;
  padding:12px;
  background:#fff;
}
.link-card h3{ margin:0 0 6px; font-size:16px; line-height:1.3; }
.link-card p { margin:6px 0 10px; color:#444; font-size:14px; }
.link-meta   { display:flex; gap:10px; color:#777; font-size:12px; }
.thumb       { width:100%; height:140px; object-fit:cover; border-radius:8px; background:#f6f6f6; margin-bottom:10px; }

.skeleton{
  animation:pulse 1.2s ease-in-out infinite;
  background:linear-gradient(90deg,#f1f1f1,#ececec,#f1f1f1);
  background-size:200% 100%;
}
@keyframes pulse{ 0%{background-position:0% 0} 100%{background-position:200% 0} }

/* === Accordion polish (All Folders page) ================================ */
#accordionExample .accordion-button,
#accordionExample .accordion-button *{
  font-family: var(--font-sans) !important;
  font-weight: 600;
  font-size: .87em;
}
#accordionExample .accordion-button{
  color:#fff;
  background: rgba(255,255,255,.10);
  border-bottom: 1px solid rgba(255,255,255,.20);
}
#accordionExample .accordion-button:not(.collapsed){
  background: rgba(255,255,255,.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.24);
}
#accordionExample .accordion-item{
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: .6rem;
  overflow: hidden;
}

/* === Buttons (Bootstrap-friendly) ======================================= */
/* Bootstrap primary = purple */
.btn-primary{
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--primary-700);
  --bs-btn-border-color: var(--primary-700);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--primary-800);
  --bs-btn-hover-border-color: var(--primary-800);
  --bs-btn-active-bg: var(--primary-900);
  --bs-btn-active-border-color: var(--primary-900);
  --bs-btn-focus-shadow-rgb: 42,39,81;
}

/* Outline primary = purple */
.btn-outline-primary{
  --bs-btn-color: var(--primary-700);
  --bs-btn-border-color: var(--primary-700);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--primary-700);
  --bs-btn-hover-border-color: var(--primary-700);
  --bs-btn-active-bg: var(--primary-800);
  --bs-btn-active-border-color: var(--primary-800);
  --bs-btn-focus-shadow-rgb: 42,39,81;
}

/* “Cute” outline pill (Share / Rename / etc.) */
.btn.btn-ghost{
  color: var(--btn-outline-text);
  background: #fff;
  border: 2px solid var(--btn-outline-border);
  border-radius: var(--btn-pill-radius);
  padding: .4rem .9rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.btn.btn-ghost:hover,
.btn.btn-ghost:focus{
  background: var(--btn-outline-bg);
  border-color: var(--btn-outline-hover);
  color: var(--brand-600);
  outline: none;
}
.btn.btn-ghost:active{
  background: rgba(254,79,180,.12);
  border-color: var(--brand);
}

/* Filled pink CTA (e.g., “Open”) */
.btn.btn-accent{
  color:#fff;
  background: linear-gradient(180deg, var(--brand), var(--brand-600));
  border: 0;
  border-radius: var(--btn-pill-radius);
  padding: .4rem .95rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(254,79,180,.28);
}
.btn.btn-accent:hover{ filter: brightness(1.05); transform: translateY(-1px); }
.btn.btn-accent:active{ filter: brightness(.98); transform: translateY(0); }

/* Destructive pill */
.btn.btn-delete{
  background: var(--brand);
  border: 0;
  color:#000; /* readable on bright pink */
  border-radius: var(--btn-pill-radius);
  padding: .4rem .95rem;
  font-weight: 700;
  line-height: 1;
}
.btn.btn-delete:hover,
.btn.btn-delete:focus{
  background:#ff64c8;
  color:#000;
  box-shadow: 0 0 0 .2rem var(--ring);
}

/* Optional: unify small buttons */
.btn.btn-sm,
.btn.btn-ghost.btn-sm,
.btn.btn-delete.btn-sm,
.btn.btn-accent.btn-sm{
  border-radius: var(--btn-pill-radius);
  padding: .3rem .7rem;
}

/* Focus ring: brand pink everywhere */
.form-control:focus,
.form-select:focus,
.btn:focus,
.btn:focus-visible{
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 .25rem var(--ring) !important;
  outline:0;
}

/* === Forms ============================================================== */
.form-control, .form-select{
  border-radius: 10px;
  border-color: var(--border);
  background-clip: padding-box;
}

/* === Modals (opt-in with .furlders-modal) =============================== */
.modal.furlders-modal .modal-content{
  background:#fff;
  color:#000;
  border:2px solid var(--brand);
  border-radius:16px;
  box-shadow:0 16px 48px rgba(0,0,0,.35);
}
.modal.furlders-modal .modal-header{
  border-bottom:1px solid var(--brand);
}
.modal.furlders-modal .modal-footer{
  border-top:1px solid var(--brand);
}
.modal.furlders-modal .btn-close{ filter:none; }

/* Inputs inside themed modals */
.modal.furlders-modal .form-control,
.modal.furlders-modal .form-select{
  color:#000;
  background:#fff;
  border:1px solid #d7d7db;
}
.modal.furlders-modal .form-control::placeholder{ color:#6c757d; }

/* Danger inside modals (use your delete pill style) */
.modal.furlders-modal .btn.btn-danger{
  background:var(--brand);
  border-color:var(--brand);
  color:#000;
}
.modal.furlders-modal .btn.btn-danger:hover,
.modal.furlders-modal .btn.btn-danger:focus{
  background:#ff64c8;
  border-color:#ff64c8;
  color:#000;
  box-shadow:0 0 0 .2rem var(--ring);
}

/* === Toasts ============================================================= */
.toast-container .toast{
  background:#fff !important;
  color:#000 !important;
  border:1px solid var(--brand);
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.toast-container .toast .btn-close{ filter:none; }

/* === Badges / Chips ===================================================== */
.badge-accent, .chip-accent{
  background: #FFB8DC;
  color: #272757;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 999px;
  padding: .25rem .5rem;
}
/* ========= Header: make the right side (search + auth) stack cleanly on small screens ========= */

/* Bootstrap lg breakpoint */
@media (max-width: 991.98px) {

  /* Let the opened mobile menu scroll instead of getting cut off */
  #navMain.collapse.show {
    max-height: calc(100vh - 72px); /* tweak 72px if your header is taller */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Make the search/auth row become a stacked block */
  .search-wrap {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.6rem;
    margin-top: 0.5rem;
  }

  /* Search input full width */
  .search-wrap .header-search {
    width: 100%;
    flex: 0 0 auto;
  }

  /* Search button full width under input (optional, but usually looks better) */
  .search-wrap button[type="submit"] {
    width: 100%;
    margin-left: 0 !important;
  }

  /* Auth blocks should also be full width and wrap nicely */
  .search-wrap [data-auth="out"],
  .search-wrap [data-auth="in"] {
    width: 100%;
    margin-left: 0 !important;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Prevent long usernames/emails from stretching the layout */
  #headerUsername {
    display: inline-block;
    max-width: 180px;          /* adjust if you want */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }

  /* If your “Sign In / Sign Up” buttons ever wrap weird, this helps */
  .btn-header {
    white-space: nowrap;
  }
}

/* Accessible focus ring (keyboard users) */
:focus { outline: none; }

:focus-visible {
  outline: 3px solid rgba(0,0,0,0.85);
  outline-offset: 3px;
}

/* Make sure common controls get it even if Bootstrap resets anything */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(0,0,0,0.85);
  outline-offset: 3px;
}

/* ========= Folder Link Cards — Option 2 (Responsive grid) ========= */

.link-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 14px 16px;
  align-items: center;
  padding: 18px;
  border-radius: 18px;
}

.link-thumb {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  overflow: hidden;
  flex: 0 0 auto;
}

.link-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.link-meta {
  min-width: 0; /* critical for ellipsis */
}

.link-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.link-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
  margin: 0;
  min-width: 0;
}

.link-url {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.9;
}

.link-desc {
  margin-top: 6px;
  opacity: 0.85;
}

.link-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.link-actions .link-btn {
  white-space: nowrap;
}

.btn-outline-delete {
  color: var(--brand) !important;
  border: 1px solid var(--brand) !important;
  background: transparent;
}

.btn-outline-delete:hover,
.btn-outline-delete:focus {
  color: #fff !important;
  border-color: var(--brand-600) !important;
  background: linear-gradient(180deg, var(--brand), var(--brand-600)) !important;
}

/* Typography polish */

body {
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.page-title,
h1, h2 {
  font-weight: 600;
  letter-spacing: 0.015em;
}

.link-title,
.card-title {
  font-weight: 500;
}

button,
.btn {
  font-weight: 500;
}
.page-title {
  margin-bottom: 4px;
}

/* --- Tablet: actions drop under meta if needed --- */
@media (max-width: 991.98px) {
  .link-row {
    grid-template-columns: 76px minmax(0, 1fr);
    grid-template-areas:
      "thumb meta"
      "actions actions";
    align-items: start;
  }

  .link-thumb { grid-area: thumb; width: 76px; height: 76px; }
  .link-meta { grid-area: meta; }
  .link-actions {
    grid-area: actions;
    justify-content: flex-start;
    margin-top: 8px;
  }
}

/* --- Mobile: button grid, primary spans full width --- */
@media (max-width: 575.98px) {
  .link-row {
    padding: 16px;
    gap: 12px 14px;
  }

  .link-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .link-actions .link-btn {
    width: 100%;
    justify-content: center;
  }

  /* Make “Open” (your primary) span the full row */
  .link-actions .btn-open {
    grid-column: 1 / -1;
  }
}

