/* ProfPaul Drive: stessa palette e stile di profpaul.icu */
:root {
  --bg: #0a0a0a;
  --fg: #f5f5f5;
  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --accent-alt: #ffaa00;
  --muted: #888888;
  --card: #151515;
  --card-2: #1c1c1c;
  --border: rgba(255,255,255,0.1);
  --glow: rgba(0,255,136,0.2);
  --danger: #ff5c5c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--fg); }
.muted { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }

.logo { font-size: 1.25rem; font-weight: 800; color: var(--fg); text-decoration: none; display: inline-block; }
.logo span { color: var(--accent); }
.logo em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .85em; }
.logo.big { font-size: 1.8rem; margin-bottom: .5rem; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 20px; background: var(--accent); color: var(--bg); border: 0; border-radius: 8px;
  font-weight: 700; cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn:hover { background: var(--fg); box-shadow: 0 6px 20px var(--glow); }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); font-weight: 600; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid rgba(255,92,92,.4); }
.mini {
  background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; line-height: 1;
}
.mini:hover { color: var(--accent); border-color: var(--accent); }

input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; outline: none; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 0; }
label input, label select { margin-top: 6px; color: var(--fg); }

/* ---------- accesso ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden; }
.login::before {
  content: ''; position: absolute; inset: -50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 60%); opacity: .35;
  animation: pulse 8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .3 } 50% { transform: scale(1.1); opacity: .5 } }
.login-card {
  position: relative; width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px 32px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.login-card .btn { width: 100%; margin-top: 20px; }
.alert { background: rgba(255,92,92,.12); border: 1px solid rgba(255,92,92,.4); color: #ffb3b3; padding: 10px 12px; border-radius: 8px; margin-top: 12px; font-size: .9rem; }

/* ---------- struttura ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; height: 100%; }
.side {
  background: rgba(10,10,10,.95); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 18px; overflow-y: auto;
}
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a {
  color: var(--muted); padding: 9px 12px; border-radius: 8px; font-weight: 500; display: flex; align-items: center; gap: 8px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.side nav a:hover { color: var(--fg); background: var(--card); }
.side nav a.on { color: var(--accent); background: var(--card); box-shadow: inset 3px 0 0 var(--accent); }
.side-h { margin: 16px 12px 4px; font-size: .75rem; text-transform: uppercase; letter-spacing: .15em; color: var(--accent); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.badge { margin-left: auto; background: var(--accent); color: var(--bg); border-radius: 999px; font-size: .72rem; font-weight: 800; padding: 1px 7px; }
.side-foot { font-size: .85rem; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.side-foot span { width: 100%; color: var(--fg); font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.top {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,.95); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
}
.burger { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.05rem; flex: 1; min-width: 0; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--border); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view { flex: 1; overflow-y: auto; padding: 20px 24px 40px; position: relative; }

/* ---------- elenco file ---------- */
.list { display: flex; flex-direction: column; gap: 4px; }
.row {
  display: grid; grid-template-columns: 34px 1fr 150px 110px 36px; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--card); border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.row:hover { border-color: var(--border); background: var(--card-2); }
.row.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--glow); }
.row .ic { font-size: 1.35rem; text-align: center; }
.row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .sz, .row .dt { color: var(--muted); font-size: .85rem; text-align: right; }
.row .thumb { width: 30px; height: 30px; object-fit: cover; border-radius: 6px; display: block; margin: auto; }
.list-h { display: grid; grid-template-columns: 34px 1fr 150px 110px 36px; gap: 10px; padding: 0 12px 6px; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.list-h span:nth-child(3), .list-h span:nth-child(4) { text-align: right; }
.empty {
  border: 2px dashed var(--border); border-radius: 16px; padding: 50px 20px; text-align: center; color: var(--muted);
}
.empty b { color: var(--fg); display: block; font-size: 1.1rem; margin-bottom: 6px; }

/* ---------- menu, finestre, avvisi ---------- */
.menu {
  position: fixed; z-index: 50; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; min-width: 190px; box-shadow: 0 12px 32px rgba(0,0,0,.6);
}
.menu button { display: flex; width: 100%; gap: 10px; background: transparent; border: 0; padding: 9px 12px; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--card); color: var(--accent); }
.menu button.danger { color: var(--danger); }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.75); backdrop-filter: blur(4px); z-index: 60;
  display: grid; place-items: center; padding: 20px;
}
.modal[hidden] { display: none; }
.box {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 26px; width: 100%; max-width: 460px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6); max-height: 90vh; overflow-y: auto;
}
.box h3 { margin-bottom: 6px; font-size: 1.2rem; }
.box .btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.box.wide { max-width: 1100px; padding: 14px; }
.viewer-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.viewer-h b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer { display: grid; place-items: center; min-height: 50vh; }
.viewer img, .viewer video { max-width: 100%; max-height: 78vh; border-radius: 8px; }
.viewer iframe { width: 100%; height: 78vh; border: 0; border-radius: 8px; background: #fff; }
.viewer pre { width: 100%; max-height: 78vh; overflow: auto; background: var(--bg); padding: 16px; border-radius: 8px; font-size: .85rem; white-space: pre-wrap; }
.copy { display: flex; gap: 8px; margin-top: 12px; }
.copy input { font-family: ui-monospace, monospace; font-size: .85rem; color: var(--accent); }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(120px); transition: transform .25s;
  background: var(--card-2); border: 1px solid var(--accent); color: var(--fg); padding: 10px 18px; border-radius: 10px; z-index: 80;
}
.toast.on { transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--danger); }

.drop {
  position: fixed; inset: 0; background: rgba(0,255,136,.08); border: 3px dashed var(--accent); z-index: 70;
  display: none; place-items: center; font-size: 1.5rem; font-weight: 800; color: var(--accent); pointer-events: none;
}
.drop.on { display: grid; }
.uploads { position: fixed; right: 20px; bottom: 20px; width: 320px; z-index: 65; display: flex; flex-direction: column; gap: 6px; }
.up { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: .85rem; }
.up .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; background: var(--border); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-alt)); transition: width .15s; }

/* ---------- team e chat ---------- */
.tabs { display: flex; gap: 6px; }
.tabs a { padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; border: 1px solid transparent; }
.tabs a.on { color: var(--accent); border-color: var(--border); background: var(--card); }
.chat { display: flex; flex-direction: column; height: 100%; }
.view { min-height: 0; }
.view.is-chat { display: flex; flex-direction: column; padding-bottom: 0; overflow: hidden; }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.msg { max-width: 72%; background: var(--card); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 9px 13px; align-self: flex-start; }
.msg.me { align-self: flex-end; background: rgba(0,255,136,.08); border-color: rgba(0,255,136,.3); border-radius: 14px 14px 4px 14px; }
.msg .who { font-size: .75rem; color: var(--accent-alt); font-weight: 700; margin-bottom: 2px; }
.msg.me .who { color: var(--accent); }
.msg .tx { white-space: pre-wrap; word-wrap: break-word; }
.msg .when { font-size: .7rem; color: var(--muted); margin-top: 4px; text-align: right; }
.msg .att { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 10px; background: var(--bg); border-radius: 8px; cursor: pointer; }
.msg .att img { max-width: 260px; max-height: 200px; border-radius: 6px; display: block; }
.day { align-self: center; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin: 8px 0; }
.compose { display: flex; gap: 8px; padding: 12px 0 18px; border-top: 1px solid var(--border); background: var(--bg); align-items: flex-end; }
.compose textarea { resize: none; height: 46px; max-height: 160px; }
.members { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.chip { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px 4px 12px; display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; }
.chip button:hover { color: var(--danger); }

/* ---------- tabelle (condivisioni, utenti) ---------- */
.cards { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.card .grow { flex: 1; min-width: 200px; }
.card .grow b { display: block; overflow: hidden; text-overflow: ellipsis; }
.card small { color: var(--muted); }
.pill { font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.pill.ok { color: var(--accent); border-color: rgba(0,255,136,.4); }
.pill.warn { color: var(--accent-alt); border-color: rgba(255,170,0,.4); }
h2.sec { font-size: 1.3rem; margin: 6px 0 14px; }

/* ---------- pagina pubblica di condivisione ---------- */
.pub { max-width: 1000px; margin: 0 auto; padding: 30px 20px 60px; }
.pub header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; gap: 12px; flex-wrap: wrap; }
.pub h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; margin-bottom: 18px; line-height: 1.15; word-break: break-word;
  background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: all .2s; color: var(--fg); display: block; }
.tile:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 24px var(--glow); color: var(--fg); }
.tile .pv { aspect-ratio: 4/3; overflow: hidden; display: grid; place-items: center; font-size: 2.6rem; background: var(--bg); }
.tile .pv img { width: 100%; height: 100%; object-fit: cover; }
.tile .cap { padding: 8px 10px; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-105%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .burger { display: inline-block; }
  .row, .list-h { grid-template-columns: 30px 1fr 36px; }
  .row .sz, .row .dt, .list-h span:nth-child(3), .list-h span:nth-child(4) { display: none; }
  .view { padding: 14px; }
  .msg { max-width: 88%; }
  .uploads { left: 14px; right: 14px; width: auto; }
}

/* riquadro informazioni sul link condiviso */
.share-info {
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 16px 20px; margin: 0 0 22px; display: flex; flex-direction: column; gap: 10px;
}
.share-who { color: var(--fg); }
.share-who b { color: var(--accent); }
.share-note {
  background: var(--bg); border-radius: 8px; padding: 12px 14px; color: var(--fg); font-size: 1.02rem;
  border: 1px solid var(--border); white-space: normal;
}
.share-exp { color: var(--muted); font-size: .92rem; }
.share-exp b { color: var(--accent-alt); }
textarea { resize: vertical; }
label textarea { margin-top: 6px; color: var(--fg); }

/* dettagli delle cartelle: ultimo file inserito */
.row .nm small { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.m-only { display: none; }
@media (max-width: 800px) {
  .row .nm small { white-space: normal; }
  .m-only { display: inline; }
}
