/* ═══════════════════════════════════════════════════
   profiles.css — Grid Cards · ExoCV 2025
═══════════════════════════════════════════════════ */

/* ── HEADER TRIGGER BUTTON ── */
.btn-profiles {
  display: flex; align-items: center; gap: .45rem;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  font-family: 'Epilogue', sans-serif;
  font-size: .73rem; font-weight: 600;
  padding: .32rem .82rem;
  cursor: pointer; transition: all .22s cubic-bezier(.4,0,.2,1);
  white-space: nowrap; flex-shrink: 0;
  letter-spacing: .01em; position: relative; overflow: hidden;
}
.btn-profiles::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(200,146,42,.15), transparent);
  opacity: 0; transition: opacity .22s;
}
.btn-profiles:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(200,146,42,.4); }
.btn-profiles:hover::before { opacity: 1; }
.btn-profiles-name { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════════════
   OVERLAY + PANEL (slides from right)
═══════════════════════════════════════════════════ */
#modalProfiles.modal-overlay {
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
  background: rgba(5,10,20,.72);
  backdrop-filter: blur(8px);
}
#modalProfiles .modal-box {
  width: 460px; max-width: 100vw;
  max-height: 100vh; height: 100vh;
  border-radius: 0;
  padding: 0; margin: 0;
  display: flex; flex-direction: column;
  background: transparent;
  box-shadow: none;
  animation: none;
  overflow: visible;
}

/* Glass panel */
.profiles-panel {
  display: flex; flex-direction: column;
  height: 100%;
  background: rgba(10,16,28,.95);
  backdrop-filter: blur(28px) saturate(180%);
  border-left: 1px solid rgba(255,255,255,.07);
  animation: slideInRight .32s cubic-bezier(.4,0,.2,1);
  position: relative; overflow: hidden;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Ambient background glow */
.profiles-panel::before {
  content: '';
  position: absolute; inset: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(ellipse 55% 35% at 85% 15%, rgba(200,146,42,.07) 0%, transparent 55%),
    radial-gradient(ellipse 45% 55% at 5% 85%, rgba(30,48,80,.35) 0%, transparent 55%);
  animation: meshFloat 9s ease-in-out infinite alternate;
  pointer-events: none; z-index: 0;
}
@keyframes meshFloat {
  from { transform: translate(0,0) rotate(0deg); }
  to   { transform: translate(2%,3%) rotate(2deg); }
}
.profiles-panel > * { position: relative; z-index: 1; }

/* ── PANEL HEADER ── */
.profiles-panel-head {
  padding: 1.8rem 1.5rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.profiles-panel-toprow {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.2rem;
}
.profiles-panel-eyebrow {
  font-size: .6rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold); margin-bottom: .3rem;
  display: flex; align-items: center; gap: .4rem;
}
.profiles-panel-eyebrow::before {
  content: ''; width: 14px; height: 1.5px;
  background: var(--gold); border-radius: 1px;
}
.profiles-panel-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem; font-weight: 700; color: #fff;
  line-height: 1.05; letter-spacing: -.3px;
}
.profiles-panel-count {
  display: inline-flex; align-items: center;
  margin-top: .35rem;
  font-size: .65rem; font-weight: 700; letter-spacing: .04em;
  color: rgba(200,146,42,.8);
  background: rgba(200,146,42,.1);
  border: 1px solid rgba(200,146,42,.18);
  padding: .18rem .6rem; border-radius: 20px;
}
.profiles-panel-close {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px; color: rgba(255,255,255,.5);
  cursor: pointer; font-size: 1rem; transition: all .18s;
}
.profiles-panel-close:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.18); }

/* ── SEARCH + NEW ── */
.profiles-search-row { display: flex; gap: .5rem; }
.profiles-search-wrap { flex: 1; position: relative; }
.profiles-search-icon {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,.25); pointer-events: none;
}
.profiles-search {
  width: 100%; font-family: 'Epilogue', sans-serif; font-size: .84rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: .6rem .85rem .6rem 2.4rem;
  outline: none; color: rgba(255,255,255,.85); transition: all .2s;
}
.profiles-search:focus {
  background: rgba(255,255,255,.08); border-color: rgba(200,146,42,.5);
  box-shadow: 0 0 0 3px rgba(200,146,42,.12);
}
.profiles-search::placeholder { color: rgba(255,255,255,.2); }

.btn-new-profile {
  display: flex; align-items: center; gap: .35rem;
  background: linear-gradient(135deg, var(--gold) 0%, #b07a1a 100%);
  color: #fff; border: none; border-radius: 10px;
  font-family: 'Epilogue', sans-serif;
  font-size: .78rem; font-weight: 700;
  padding: .6rem 1rem; cursor: pointer;
  transition: all .2s; white-space: nowrap; flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(200,146,42,.35), inset 0 1px 0 rgba(255,255,255,.15);
  letter-spacing: .01em;
}
.btn-new-profile:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(200,146,42,.5); }
.btn-new-profile:active { transform: translateY(0); }

/* ── LIST → GRID CONTAINER ── */
#profilesList {
  flex: 1; overflow-y: auto;
  padding: .9rem 1rem 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}
#profilesList::-webkit-scrollbar { width: 4px; }
#profilesList::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* Section labels span full width */
.profiles-section-label {
  grid-column: 1 / -1;
  font-size: .6rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: rgba(255,255,255,.2); padding: .4rem .3rem .2rem;
  display: flex; align-items: center; gap: .5rem;
}
.profiles-section-label::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.06);
}

/* Empty state */
.profiles-empty {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3.5rem 1rem; color: rgba(255,255,255,.2); gap: .9rem; text-align: center;
}
.profiles-empty svg { opacity: .35; }
.profiles-empty p { font-size: .86rem; line-height: 1.7; color: rgba(255,255,255,.25); }

/* ═══════════════════════════════════════════════════
   PROFILE CARD — 2-column grid cards
═══════════════════════════════════════════════════ */
.pf-card {
  border-radius: 16px;
  border: 1.5px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  overflow: hidden;
  cursor: pointer;
  transition: all .22s cubic-bezier(.4,0,.2,1);
  position: relative;
  display: flex; flex-direction: column;
}
.pf-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.07);
}
.pf-card.active {
  border-color: rgba(200,146,42,.5);
  box-shadow: 0 0 0 1px rgba(200,146,42,.18), 0 8px 28px rgba(200,146,42,.18);
  background: rgba(200,146,42,.05);
}

/* Entrance animation */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pf-card { animation: cardIn .28s cubic-bezier(.4,0,.2,1) both; }
.pf-card:nth-child(1) { animation-delay: .04s; }
.pf-card:nth-child(2) { animation-delay: .07s; }
.pf-card:nth-child(3) { animation-delay: .10s; }
.pf-card:nth-child(4) { animation-delay: .13s; }
.pf-card:nth-child(5) { animation-delay: .16s; }
.pf-card:nth-child(n+6) { animation-delay: .19s; }

/* ── CARD HEADER (colored band) ── */
.pf-card-head {
  height: 68px;
  position: relative;
  flex-shrink: 0;
}
/* Gloss sheen on header */
.pf-card-head::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.14) 0%, transparent 65%);
  pointer-events: none; z-index: 1;
}

/* Avatar — half-hanging below header */
.pf-card-avatar {
  position: absolute;
  bottom: -19px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 40px;
  border-radius: 11px;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem; font-weight: 700; color: #fff;
  border: 2px solid rgba(255,255,255,.22);
  box-shadow: 0 5px 18px rgba(0,0,0,.45);
  z-index: 2;
  transition: transform .22s;
}
.pf-card:hover .pf-card-avatar { transform: translateX(-50%) scale(1.1) rotate(-2deg); }

/* Active dot */
.pf-card-active-dot {
  position: absolute; top: 8px; left: 9px; z-index: 2;
  display: flex; align-items: center; gap: .28rem;
  font-size: .55rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: rgba(255,255,255,.9);
}
.pf-card-active-dot::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74,222,128,.9);
}

/* Floating action buttons (header, revealed on hover/active) */
.pf-card-actions {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  display: flex; gap: 3px;
  opacity: 0; transform: translateY(-5px);
  transition: all .18s cubic-bezier(.4,0,.2,1);
}
.pf-card:hover .pf-card-actions,
.pf-card.active .pf-card-actions { opacity: 1; transform: translateY(0); }

.pf-card-actions .pf-btn {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.65);
  cursor: pointer; transition: all .15s; font-size: .6rem;
}
.pf-card-actions .pf-btn:hover { background: rgba(0,0,0,.75); color: #fff; transform: scale(1.12); }
.pf-card-actions .pf-btn:active { transform: scale(.92); }
.pf-card-actions .pf-btn.pf-star.starred { color: var(--gold); }
.pf-card-actions .pf-btn.pf-star:hover { color: var(--gold); }
.pf-card-actions .pf-btn.pf-del:hover { background: rgba(181,43,43,.5); color: #f87171; border-color: rgba(181,43,43,.3); }

/* ── CARD BODY ── */
.pf-card-body {
  padding: 1.55rem .75rem .45rem;
  text-align: center;
  flex: 1;
}
.pf-card-name {
  font-size: .84rem; font-weight: 700; color: rgba(255,255,255,.9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -.01em; margin-bottom: .18rem;
  display: flex; align-items: center; justify-content: center; gap: .28rem;
}
.profile-star-icon { color: var(--gold); font-size: .7rem; line-height: 1; flex-shrink: 0; }
.pf-card-preview {
  font-size: .69rem; color: rgba(255,255,255,.28);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── CARD FOOT (date + template) ── */
.pf-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: .45rem .75rem;
  border-top: 1px solid rgba(255,255,255,.05);
  margin-top: .35rem;
}
.pf-card-date {
  font-size: .61rem; color: rgba(255,255,255,.2);
  display: flex; align-items: center; gap: .22rem;
}
.pf-card-tpl {
  font-size: .58rem; color: rgba(255,255,255,.25);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.07);
  padding: .05rem .38rem; border-radius: 5px;
  text-transform: capitalize;
}

/* ── OPEN BUTTON ROW ── */
.pf-card-open {
  padding: .42rem .65rem .6rem;
}
.pf-btn.pf-load {
  display: flex; align-items: center; justify-content: center; gap: .3rem;
  width: 100%; padding: .38rem;
  background: rgba(200,146,42,.13);
  border: 1px solid rgba(200,146,42,.22);
  border-radius: 8px;
  color: var(--gold-lt);
  font-family: 'Epilogue', sans-serif;
  font-size: .69rem; font-weight: 700;
  cursor: pointer; transition: all .18s;
  letter-spacing: .04em; height: auto;
}
.pf-btn.pf-load:hover {
  background: rgba(200,146,42,.26);
  border-color: rgba(200,146,42,.45);
  color: #fff;
  transform: none;
}
.pf-btn.pf-current {
  display: flex; align-items: center; justify-content: center; gap: .3rem;
  width: 100%; padding: .38rem;
  background: rgba(74,222,128,.07);
  border: 1px solid rgba(74,222,128,.18);
  border-radius: 8px;
  color: rgba(74,222,128,.65);
  font-family: 'Epilogue', sans-serif;
  font-size: .69rem; font-weight: 700;
  letter-spacing: .04em; height: auto;
  cursor: default;
}

/* ── PANEL FOOTER ── */
.profiles-panel-footer {
  padding: .85rem 1.4rem;
  border-top: 1px solid rgba(255,255,255,.05);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(0,0,0,.2);
}
.profiles-footer-info {
  display: flex; align-items: center; gap: .4rem;
  font-size: .69rem; color: rgba(255,255,255,.2);
}

/* Cloud sync indicator */
.profiles-footer-cloud {
  display: flex; align-items: center; gap: 6px;
  font-size: .72rem; color: var(--muted); margin-top: 6px;
}
.profiles-footer-cloud svg { color: #9b6dff; }
.profiles-footer-cloud.offline { color: rgba(136,146,176,.4); }
.profiles-footer-cloud.offline svg { color: rgba(136,146,176,.4); }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 600px) {
  #modalProfiles .modal-box { width: 100vw; }
  .profiles-panel-title { font-size: 1.5rem; }
  #profilesList { grid-template-columns: 1fr; }
  .btn-profiles-name { display: none; }
  .pf-card-actions { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   LIGHT MODE
══════════════════════════════════════════════════════════════ */
html[data-theme="light"] .profiles-panel {
  background: rgba(250,251,253,.97);
  border-left-color: rgba(15,23,42,.09);
}
html[data-theme="light"] .profiles-panel::before {
  background:
    radial-gradient(ellipse 55% 35% at 85% 15%, rgba(176,114,25,.06) 0%, transparent 55%),
    radial-gradient(ellipse 45% 55% at 5% 85%, rgba(226,232,240,.5) 0%, transparent 55%);
}
html[data-theme="light"] .profiles-panel-title { color: #0d1117; }
html[data-theme="light"] .profiles-panel-close {
  background: rgba(15,23,42,.06); border-color: rgba(15,23,42,.1);
  color: rgba(15,23,42,.45);
}
html[data-theme="light"] .profiles-panel-close:hover {
  background: rgba(15,23,42,.1); color: #0d1117; border-color: rgba(15,23,42,.18);
}
html[data-theme="light"] .profiles-panel-head { border-bottom-color: rgba(15,23,42,.07); }
html[data-theme="light"] .profiles-search {
  background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.1);
  color: #0d1117;
}
html[data-theme="light"] .profiles-search:focus {
  background: #fff; border-color: rgba(176,114,25,.5);
  box-shadow: 0 0 0 3px rgba(176,114,25,.1);
}
html[data-theme="light"] .profiles-search::placeholder { color: rgba(15,23,42,.3); }
html[data-theme="light"] .profiles-search-icon { color: rgba(15,23,42,.3); }
html[data-theme="light"] .profiles-panel-footer {
  background: rgba(15,23,42,.03); border-top-color: rgba(15,23,42,.07);
}
html[data-theme="light"] .profiles-footer-info { color: rgba(15,23,42,.3); }
html[data-theme="light"] .profiles-footer-cloud { color: rgba(15,23,42,.35); }

/* Light mode cards */
html[data-theme="light"] .pf-card {
  background: #fff;
  border-color: rgba(15,23,42,.09);
  box-shadow: 0 1px 4px rgba(15,23,42,.05);
}
html[data-theme="light"] .pf-card:hover {
  background: #fff;
  border-color: rgba(176,114,25,.22);
  box-shadow: 0 8px 28px rgba(15,23,42,.1);
}
html[data-theme="light"] .pf-card.active {
  border-color: rgba(176,114,25,.4);
  background: rgba(176,114,25,.03);
  box-shadow: 0 0 0 1px rgba(176,114,25,.15), 0 6px 20px rgba(176,114,25,.1);
}
html[data-theme="light"] .pf-card-name { color: #0d1117; }
html[data-theme="light"] .pf-card-preview { color: rgba(15,23,42,.4); }
html[data-theme="light"] .pf-card-foot { border-top-color: rgba(15,23,42,.06); }
html[data-theme="light"] .pf-card-date { color: rgba(15,23,42,.3); }
html[data-theme="light"] .pf-card-tpl {
  color: rgba(15,23,42,.35);
  background: rgba(15,23,42,.05);
  border-color: rgba(15,23,42,.07);
}
html[data-theme="light"] .pf-card-actions .pf-btn {
  background: rgba(255,255,255,.85);
  border-color: rgba(15,23,42,.12);
  color: rgba(15,23,42,.5);
}
html[data-theme="light"] .pf-card-actions .pf-btn:hover {
  background: rgba(15,23,42,.08); color: #0d1117;
}
html[data-theme="light"] .pf-card-actions .pf-btn.pf-del:hover {
  background: rgba(181,43,43,.12); color: #dc2626;
}
html[data-theme="light"] .pf-btn.pf-load {
  background: rgba(176,114,25,.08);
  border-color: rgba(176,114,25,.2);
  color: #9a6218;
}
html[data-theme="light"] .pf-btn.pf-load:hover {
  background: rgba(176,114,25,.18);
  border-color: rgba(176,114,25,.35);
  color: #7a4c10;
}
html[data-theme="light"] .pf-btn.pf-current {
  background: rgba(74,222,128,.06);
  border-color: rgba(74,222,128,.2);
  color: #16a34a;
}
html[data-theme="light"] .profiles-section-label { color: rgba(15,23,42,.28); }
html[data-theme="light"] .profiles-section-label::after { background: rgba(15,23,42,.08); }
html[data-theme="light"] .profiles-empty { color: rgba(15,23,42,.3); }
html[data-theme="light"] .profiles-empty p { color: rgba(15,23,42,.35); }
html[data-theme="light"] .btn-profiles {
  background: rgba(15,23,42,.06); color: rgba(15,23,42,.6);
  border-color: rgba(15,23,42,.1);
}
html[data-theme="light"] .btn-profiles:hover {
  background: rgba(15,23,42,.09); color: #0d1117;
  border-color: rgba(176,114,25,.3);
}
