/* =========================================
   CRM Task Manager — Custom Styles
   Bootstrap 5 base + custom overrides
   ========================================= */

:root {
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --primary: #0d6efd;
}

/* ---- LAYOUT ---- */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f5f6fa;
}

#page-app {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid #e9ecef;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.28s ease;
}

.sidebar-brand {
  min-height: var(--topbar-height);
}

.sidebar .nav-link {
  color: #495057;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.15s, color 0.15s;
}
.sidebar .nav-link:hover {
  background: #f0f4ff;
  color: var(--primary);
}
.sidebar .nav-link.active {
  background: #e8f0fe;
  color: var(--primary);
  font-weight: 600;
}
.sidebar .nav-link i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.content-area {
  flex: 1;
}

/* ---- SIDEBAR AVATAR ---- */
.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---- KPI CARDS ---- */
.kpi-card {
  border-radius: 12px !important;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}
.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

/* ---- TASK CARDS ---- */
.task-card {
  border-radius: 12px !important;
  border: 1px solid #e9ecef !important;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.task-card:hover {
  border-color: #0d6efd66 !important;
  box-shadow: 0 4px 15px rgba(13,110,253,0.1) !important;
  transform: translateY(-2px);
}
.task-card .card-body { padding: 1rem 1.1rem; }

/* ---- PRIORITA BADGES ---- */
.badge-urgente { background-color: #dc3545; }
.badge-alta    { background-color: #fd7e14; }
.badge-media   { background-color: #0d6efd; }
.badge-bassa   { background-color: #6c757d; }

/* ---- STATO BADGES ---- */
.badge-aperto     { background-color: #0dcaf0; color: #000; }
.badge-in_corso   { background-color: #ffc107; color: #000; }
.badge-completato { background-color: #198754; }
.badge-annullato  { background-color: #6c757d; }

/* ---- COMMENTI ---- */
.commenti-list {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}
.commento-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
}
.commento-item .commento-autore {
  font-weight: 600;
  font-size: 0.78rem;
  color: #495057;
}
.commento-item .commento-data {
  font-size: 0.72rem;
  color: #adb5bd;
}

/* ---- PRODOTTI nel task modal ---- */
.prodotto-row {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- MOBILE ---- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
}

/* ---- TABLE STYLES ---- */
.table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
  font-weight: 600;
}

/* ---- MISC ---- */
.card {
  border-radius: 12px !important;
}
.modal-content {
  border-radius: 16px !important;
}
.btn {
  border-radius: 8px;
}
.form-control, .form-select, .input-group-text {
  border-radius: 8px !important;
}
.input-group .form-control:not(:last-child),
.input-group .input-group-text:not(:last-child) {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.input-group .form-control:not(:first-child),
.input-group .input-group-text:not(:first-child),
.input-group .btn:not(:first-child) {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

/* ---- LANDING PAGE — OpusForme ---- */

/* Blocca lo scroll del body quando la landing è visibile */
html:has(#page-landing:not(.d-none)) {
  overflow: hidden;
}

#page-landing {
  width: 100vw;
  height: 100vh;   /* fallback */
  height: 100dvh;  /* dvh = dynamic viewport height, corregge il bug iOS Safari con la browser bar */
  overflow: hidden;
}

.of-landing {
  width: 100vw;
  height: 100vh;   /* fallback */
  height: 100dvh;
  background-image: url('/img/opus-desktop.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile: immagine verticale */
@media (max-width: 767.98px) {
  .of-landing {
    background-image: url('/img/opus-mobile.png');
  }
}

/* Contenitore icone social */
.of-social {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 124px;
}

/* Mobile: icone in colonna */
@media (max-width: 767.98px) {
  .of-social {
    flex-direction: column;
    gap: 84px;
  }
}

/* Singola icona social */
.of-social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  transition: transform 0.18s ease;
}

/* Icone SVG inline — colore gestito via currentColor, identico all'icona mail */
.of-social-icon svg {
  width: 44px;
  height: 44px;
  display: block;
  color: #fff;
  transition: color 0.18s ease;
}

/* Icona email (Bootstrap Icons font) */
.of-social-icon i {
  font-size: 2.6rem;
  line-height: 1;
  display: block;
  color: #fff;
  transition: color 0.18s ease;
}

.of-social-icon:hover {
  transform: scale(1.14);
}

/* Mobile */
@media (max-width: 767.98px) {
  .of-social-icon svg {
    width: 48px;
    height: 48px;
  }
  .of-social-icon i {
    font-size: 2.8rem;
    line-height: 1;
    display: block;
  }
}

/* Vetrina product cards */
.vetrina-card {
  border-radius: 16px !important;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  border: none !important;
}

.vetrina-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.13) !important;
}

.vetrina-card .card-img-top {
  height: 210px;
  object-fit: cover;
}

.vetrina-img-placeholder {
  height: 210px;
  background: linear-gradient(135deg, #e8f0fe 0%, #f0f4ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: #0d6efd;
}

/* Admin vetrina cards */
.vetrina-admin-card {
  position: relative;
  border-radius: 12px !important;
  border: 1px solid #e9ecef !important;
}

.vetrina-admin-card .card-img-top {
  height: 160px;
  object-fit: cover;
  border-radius: 11px 11px 0 0;
}
