/* ═══════════════════════════════════════════
 * PROJETOS.CSS
 * ═══════════════════════════════════════════ */

.projetos-main {
  padding: 0 !important;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.projetos-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  scrollbar-width: none;
}

.projetos-scroll::-webkit-scrollbar { display: none; }
.projetos-scroll::-webkit-scrollbar-track { background: transparent; }
.projetos-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
}

/* ─── Header ─── */
.projetos-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
}

.projetos-header__left h1 {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 700;
  margin-bottom: 4px;
}

.projetos-header__left p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Toolbar ─── */
.projetos-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.projetos-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 var(--space-sm);
  flex: 1;
  min-width: 200px;
}

.projetos-search svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.projetos-search input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  padding: 9px var(--space-sm);
  outline: none;
  width: 100%;
}

.projetos-search input::placeholder { color: var(--text-muted); }

/* ─── Status pills ─── */
.status-filters {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.status-pill svg { width: 12px; height: 12px; }

.status-pill:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
}

.status-pill.is-active {
  background: rgba(255,176,32,0.12);
  color: var(--accent-primary);
  border-color: rgba(255,176,32,0.3);
}

.status-pill.is-active[data-status="active"] {
  background: rgba(74,222,128,0.1);
  color: #4ADE80;
  border-color: rgba(74,222,128,0.25);
}

.status-pill.is-active[data-status="done"] {
  background: rgba(100,180,255,0.1);
  color: #64B4FF;
  border-color: rgba(100,180,255,0.25);
}

.status-pill.is-active[data-status="pause"] {
  background: rgba(255,176,32,0.1);
  color: var(--accent-primary);
  border-color: rgba(255,176,32,0.25);
}

/* ─── Grid ─── */
.projetos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  align-content: start;
}

/* ─── Card ─── */
.projeto-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.projeto-card:hover {
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-3px);
}

.projeto-card.is-hidden { display: none; }

.projeto-card__thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.projeto-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  display: block;
}

.projeto-card:hover .projeto-card__thumb img { transform: scale(1.05); }

.projeto-card__status {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.projeto-card__status--active { background: rgba(74,222,128,0.2);  color: #4ADE80; }
.projeto-card__status--done   { background: rgba(100,180,255,0.2); color: #64B4FF; }
.projeto-card__status--pause  { background: rgba(255,176,32,0.2);  color: var(--accent-primary); }

.projeto-card__count {
  position: absolute;
  bottom: var(--space-sm);
  left: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.projeto-card__count svg { width: 11px; height: 11px; }

.projeto-card__body {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
}

.projeto-card__name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.projeto-card__client {
  font-size: 12px;
  color: var(--text-muted);
}

.projeto-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-xs);
}

.projeto-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
}

.projeto-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg) var(--space-md);
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: auto;
}

.projeto-card__date {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.projeto-card__date svg { width: 12px; height: 12px; }

.projeto-card__actions {
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.projeto-card:hover .projeto-card__actions { opacity: 1; }

.projeto-card__action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.projeto-card__action-btn svg { width: 13px; height: 13px; }

.projeto-card__action-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-main);
}

.projeto-card__action-btn--danger:hover {
  background: rgba(255,75,75,0.12);
  color: var(--accent-secondary);
}

/* ─── Formulário dos modais ─── */
.novo-projeto-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.pj-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.pj-modal-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.pj-modal-x:hover { color: var(--text-main); }
.pj-modal-x svg   { width: 18px; height: 18px; }

.pj-modal-submit {
  width: 100%;
  margin-top: var(--space-xs);
}

/* ─── Confirm toast ─── */
.confirm-toast {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-panel);
  border: 1px solid rgba(255,75,75,0.35);
  border-radius: var(--radius-lg);
  padding: 14px var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.confirm-toast.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.confirm-toast__msg {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.confirm-toast__msg strong { color: var(--accent-secondary); }

.confirm-toast__actions { display: flex; gap: var(--space-sm); }

.confirm-toast__cancel {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.confirm-toast__cancel:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-main);
}

.confirm-toast__confirm {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: rgba(255,75,75,0.15);
  color: var(--accent-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.confirm-toast__confirm:hover { background: rgba(255,75,75,0.28); }

/* ─── Modais desktop — centralizados ─── */
@media (min-width: 1025px) {
  #modal-novo-projeto,
  #modal-editar-projeto {
    top: 50%;
    left: 50%;
    bottom: auto;
    right: auto;
    width: 480px;
    max-width: calc(100vw - 48px);
    max-height: 85vh;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 32px 80px rgba(0,0,0,0.6);
    z-index: var(--z-modal);
    /* Fechado */
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -46%);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  #modal-novo-projeto.is-active,
  #modal-editar-projeto.is-active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
  }

  #modal-novo-projeto .bottom-sheet-handle,
  #modal-editar-projeto .bottom-sheet-handle {
    display: none;
  }

  #modal-novo-projeto .tool-panel-content,
  #modal-editar-projeto .tool-panel-content {
    padding: var(--space-xl);
    max-height: 85vh;
    overflow-y: auto;
  }

  .modal-overlay.is-active {
    z-index: calc(var(--z-modal) - 1);
  }
}

/* ─── Mobile ─── */
@media (max-width: 1024px) {

  .projetos-scroll {
    padding: var(--space-md) var(--space-md) calc(var(--space-2xl) + 64px);
  }

  .projetos-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .projetos-header .btn {
    width: 100%;
    justify-content: center;
  }

  .projetos-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-md);
  }

  .projeto-card__actions { opacity: 1; }

  .confirm-toast {
    bottom: 80px;
    max-width: calc(100vw - 32px);
    white-space: normal;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .confirm-toast__actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .projetos-grid { grid-template-columns: 1fr; }

  .projetos-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .status-filters {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .status-filters::-webkit-scrollbar { display: none; }
}
