/* =========================================================
   01. RESET E TOKENS GLOBAIS
   ========================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #ec4899;
  --success: #10b981;
  --orange: #f59e0b;
  --blue: #0ea5e9;
  --gray: #64748b;
  --danger: #ef4444;

  --bg: #0f172a;
  --bg-light: #1e293b;
  --bg-lighter: #334155;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);

  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --border: #475569;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.22);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--bg) 0%, #1a2f4f 100%);
  color: var(--text);
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

/* =========================================================
   02. CABEÇALHO
   ========================================================= */
.zienaps-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.header-left,
.header-center {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.user-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.5rem 0.8rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  cursor: pointer;
  user-select: none;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.user-info:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text);
}

/* =========================================================
   03. CONTROLES SUPERIORES
   ========================================================= */
.view-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.25rem;
}

.view-btn {
  padding: 0.55rem 0.95rem;
  border: none;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.view-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.view-btn.active {
  background: var(--success);
  color: #fff;
}

.search-container {
  display: flex;
  align-items: center;
  position: relative;
  transition: width 0.3s ease;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 1rem;
  pointer-events: none;
  color: var(--text-muted);
}

.search-box {
  width: 44px;
  padding: 0.6rem 0.8rem 0.6rem 2.3rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  color: var(--text);
  font-size: 0.92rem;
  transition: width 0.3s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.search-box:focus {
  width: 260px;
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-box::placeholder {
  color: var(--text-muted);
}

.filter-toggle,
.ghost-action-btn {
  border-radius: 0.7rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s ease;
  font-size: 0.9rem;
  white-space: nowrap;
}

.filter-toggle {
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  border: 1px solid var(--primary);
  color: white;
}

.filter-toggle:hover {
  background: var(--primary-dark);
}

.ghost-action-btn {
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.ghost-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* =========================================================
   04. LAYOUT PRINCIPAL
   ========================================================= */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
}

.section-title-row .section-title {
  margin-bottom: 0;
}

.section-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
  margin: 2.5rem 0 2rem;
}

.empty-state,
.empty-inline-state {
  text-align: center;
  color: var(--text-muted);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
}

.empty-inline-state {
  padding: 1rem;
  min-width: 220px;
}

/* =========================================================
   05. GRIDS E CARROSSEIS
   ========================================================= */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  justify-items: center;
}

.carousel-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.25rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.carousel-row::-webkit-scrollbar {
  height: 6px;
}

.carousel-row::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.carousel-row::-webkit-scrollbar-track {
  background: transparent;
}

.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: flex-start;
  padding: 1rem 0;
}

/* =========================================================
   06. CARDS DE PROJETO
   ========================================================= */
.project-card {
  position: relative;
  width: 100%;
  max-width: 280px;
  min-height: 100%;
  background: linear-gradient(135deg, var(--bg-light) 0%, rgba(51, 65, 85, 0.5) 100%);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--primary);
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.2);
}

.project-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 5;
}

.project-image {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  overflow: hidden;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.project-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.project-folder-hint {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.55;
  margin-left: 0.4rem;
}

.project-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-type,
.project-status {
  padding: 0.35rem 0.75rem;
  border-radius: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.project-type {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
}

.project-status {
  background: rgba(255, 255, 255, 0.06);
}

.project-link {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 0.75rem 1.2rem;
  border-radius: 0.65rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  width: calc(100% - 2rem);
  margin: 0 1rem 1rem;
  transition: all 0.25s ease;
}

.project-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

/* =========================================================
   07. STATUS
   ========================================================= */
.status-ativo {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.status-publicado,
.status-finalizado {
  background: rgba(14, 165, 233, 0.15);
  color: var(--blue);
}

.status-primeira-publicacao {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.status-atualizacao,
.status-atualização,
.status-remasterizacao {
  background: rgba(236, 72, 153, 0.16);
  color: #f9a8d4;
}

.status-arquivado {
  background: rgba(100, 116, 139, 0.22);
  color: #cbd5e1;
}

.status-abandonado,
.status-privado {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}

.border-status-primeira-publicacao {
  border: 2px solid #6366f1 !important;
}

/* =========================================================
   08. BADGES E DESTAQUES
   ========================================================= */
.badge-novidade {
  display: inline-block;
  background: linear-gradient(135deg, #ff6b6b, #ff8787);
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.destaque-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 240px;
  flex: 0 0 auto;
}

.destaque-item:hover {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.2);
  transform: translateY(-2px);
}

.destaque-emoji {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.destaque-body {
  min-width: 0;
}

.destaque-nome {
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.2;
}

.destaque-info {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.remove-btn-mini {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.remove-btn-mini:hover {
  opacity: 1;
}

/* =========================================================
   09. CARDS DE ACESSO RECENTE
   ========================================================= */
.acesso-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 180px;
}

.acesso-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}

.acesso-card-emoji {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.acesso-card-name {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.acesso-card-date {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.acesso-card-count {
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.55rem;
}

/* =========================================================
   10. MODO GALERIA / STORIES
   ========================================================= */
.story-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s ease;
  width: 100px;
}

.story-card:hover {
  transform: scale(1.05);
}

.story-badge {
  position: absolute;
  top: 0.3rem;
  right: 0.1rem;
  z-index: 2;
  font-size: 0.6rem;
}

.story-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-light);
  padding: 3px;
  font-size: 2rem;
  transition: all 0.25s ease;
}

.story-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.story-card:hover .story-circle {
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.35);
}

.story-name {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  line-height: 1.15;
  width: 100%;
}

.story-folder-hint {
  font-size: 0.6rem;
  opacity: 0.55;
  margin-top: 0.2rem;
}

.stories-view .projects-grid {
  display: none;
}

.normal-view .stories-section {
  display: none;
}

.stories-section {
  display: none;
}

.stories-view .stories-section {
  display: block;
}

/* =========================================================
   11. MODAIS
   ========================================================= */
.modal-container {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-content {
  width: min(100%, 560px);
  background: linear-gradient(135deg, var(--bg-light) 0%, rgba(51, 65, 85, 0.92) 100%);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-content-wide {
  width: min(100%, 720px);
}

.modal-content h2 {
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 1.1rem;
}

.modal-content input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.modal-content input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.modal-actions button {
  border: none;
  cursor: pointer;
  padding: 0.8rem 1rem;
  border-radius: 0.7rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.modal-actions button:first-child {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.modal-actions button:last-child {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.modal-actions button:hover {
  transform: translateY(-1px);
}

/* =========================================================
   12. RASTREAMENTO
   ========================================================= */
.rastreamento-conteudo {
  display: grid;
  gap: 1rem;
}

.tracking-hero-card {
  background: var(--bg);
  padding: 1rem;
  border-radius: 0.75rem;
  border-left: 4px solid var(--success);
  display: grid;
  gap: 0.5rem;
}

.tracking-url {
  word-break: break-all;
}

.tracking-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.tracking-stat-card {
  background: var(--bg);
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

.tracking-stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.tracking-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--success);
}

.tracking-stat-text {
  font-size: 0.9rem;
  color: var(--text);
}

/* =========================================================
   13. RESPONSIVIDADE
   ========================================================= */
@media (max-width: 860px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }

  .header-left,
  .header-center {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .search-container {
    flex: 1 1 220px;
  }
}

@media (max-width: 768px) {
  .zienaps-header,
  .main-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .search-box {
    width: 38px;
  }

  .search-box:focus {
    width: 210px;
  }

  .gallery-grid {
    gap: 1.25rem;
  }

  .story-card {
    width: 92px;
  }

  .story-circle {
    width: 74px;
    height: 74px;
  }
}
