@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Montserrat:wght@400;600;700&display=swap');

:root {
  --primary: #1a4fa0;
  --primary-light: #2563c7;
  --primary-dark: #123580;
  --accent: #e85d1e;
  --main-font: 'Montserrat', sans-serif;
  --site-bg: #f4f7fb;
  --header-bg: #ffffff;
  --header-color: #333333;
  --header-size: 90px;
  --logo-scale: 1;
}

* {margin:0;padding:0;box-sizing:border-box;}

body {
  font-family: var(--main-font);
  background: var(--site-bg);
  color: #333;
  transition: background 0.3s, font-family 0.3s, margin-left 0.3s;
}

/* -------------------------------------
   CABEÇALHO (Top Bar / Sidebar)
------------------------------------- */
.top-bar {
  background: var(--header-bg);
  color: var(--header-color);
  width: 100%;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  display: flex;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  z-index: 100;
}

.top-bar-content {
  width: 100%;
  max-width: 1200px;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center; /* Override by JS for Topbar position */
  min-height: var(--header-size);
}

.top-bar .logo img {
  max-height: calc(var(--header-size) - 20px);
  transform: scale(var(--logo-scale));
  width: auto;
  display: block;
  transition: all 0.3s ease;
}

/* Quando layout for Sidebar */
body.layout-sidebar {
  display: flex;
}
body.layout-sidebar .top-bar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--header-size);
  height: 100vh;
  border-right: 1px solid rgba(0,0,0,0.08);
  border-bottom: none;
  box-shadow: 4px 0 15px rgba(0,0,0,0.08);
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}
body.layout-sidebar .top-bar-content {
  flex-direction: column;
  padding: 2rem 1rem;
  justify-content: flex-start;
  gap: 2rem;
  height: 100%;
}
body.layout-sidebar .header-actions {
  flex-direction: column;
  margin-top: auto;
}
body.layout-sidebar .top-bar .logo img {
  max-width: calc(var(--header-size) - 20px);
  max-height: auto;
}
body.layout-sidebar .main-content {
  margin-left: var(--header-size);
  width: calc(100% - var(--header-size));
}

.admin-lock-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s;
  outline: none;
  filter: grayscale(1); /* Neutraliza para combinar com a cor */
}

.admin-lock-btn:hover {
  transform: scale(1.1);
  filter: grayscale(0);
}

/* -------------------------------------
   CONTEÚDO E GRID
------------------------------------- */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-auto-flow: dense;
  gap: 2rem;
}

/* Cards (Polimórficos) */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.card-content {
  padding: 1.5rem;
  position: relative;
  z-index: 2;
}

.card-wide {
  grid-column: span 2;
}

.card-type-app {
  color: #005aa3;
}
.card-type-app .card-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem auto;
  border: 2px solid rgba(0,0,0,0.1);
  display: block;
}
.card-type-app h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.card-type-app p {
  font-size: 0.9rem;
  color: #666;
  font-weight: 400;
}

/* Card Especial (+) */
.card.add-card {
  background: transparent;
  border: 2px dashed #005aa3;
  color: #005aa3;
  box-shadow: none;
  cursor: pointer;
  display: none;
}
body.admin-mode .card.add-card { display: flex; }
.card.add-card:hover { background: rgba(0,90,163,0.05); }
.card.add-card .plus-icon {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Ações (Editar e Remover) */
.card-actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
  z-index: 10;
  background: rgba(255,255,255,0.8);
  padding: 4px;
  border-radius: 8px;
}
body.admin-mode .card:hover .card-actions {
  opacity: 1;
  visibility: visible;
}
.action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.7;
}
.action-btn:hover { transform: scale(1.1); opacity: 1; }

/* -------------------------------------
   MODAIS E TABS
------------------------------------- */
.modal-overlay {
  position: fixed;
  top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  width: 100%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.modal-content h3 {
  margin-bottom: 1.5rem;
  color: #005aa3;
}
.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}
.form-group label {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: #555;
  font-weight: 600;
}
.form-group input, .form-group select {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: #005aa3;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
}
.tab-btn {
  background: none;
  border: none;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s;
}
.tab-btn.active {
  background: #eef2ff;
  color: #005aa3;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-cancel { background: #e2e8f0; color: #475569; }
.btn-cancel:hover { background: #cbd5e1; }
.btn-primary { background: #005aa3; color: white; }
.btn-primary:hover { background: #004580; }

@media (max-width:768px) {
  body.layout-sidebar { flex-direction: column; }
  body.layout-sidebar .top-bar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    padding: 1rem;
  }
  body.layout-sidebar .top-bar-content {
    flex-direction: row;
    height: auto;
  }
  body.layout-sidebar .header-actions {
    flex-direction: row;
    margin-top: 0;
  }
  body.layout-sidebar .main-content {
    margin-left: 0;
    width: 100%;
  }
  .card-wide { grid-column: span 1; }
}

/* -------------------------------------
   LANDING PAGE
------------------------------------- */
.landing-title {
  text-align: center;
  color: var(--primary);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}
.landing-subtitle {
  text-align: center;
  color: #64748b;
  font-size: 1rem;
  margin-bottom: 2.5rem;
}
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}
.landing-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transition: transform .2s, box-shadow .2s;
  border: 2px solid transparent;
}
.landing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: var(--primary);
}
.landing-card-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  overflow: hidden;
}
.landing-card-name {
  font-weight: 700;
  font-size: 1rem;
  color: #333;
}
.landing-card-internal {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
}
.landing-card-internal:hover { border-color: #fff; }
.landing-card-internal .landing-card-icon { font-size: 2rem; margin: 0; }
.landing-card-internal .landing-card-name { color: #fff; font-size: 1.2rem; }
.landing-card-internal .landing-card-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.2);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* -------------------------------------
   PIN PAGE
------------------------------------- */
.pin-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}
.pin-box {
  background: #fff;
  border-radius: 16px;
  padding: 3rem 2.5rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  max-width: 420px;
  width: 100%;
}
.pin-logo { margin-bottom: 1.5rem; }
.pin-logo img {
  max-height: 80px;
  width: auto;
}
.pin-name {
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 0.5rem;
}
.pin-label {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.pin-inputs {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.pin-field {
  width: 52px;
  height: 60px;
  text-align: center;
  font-size: 1.5rem;
  font-family: monospace;
  font-weight: 700;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  text-transform: uppercase;
}
.pin-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,90,163,0.15);
}
.pin-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  min-height: 1.2rem;
}
.pin-btn { width: 100%; font-size: 1rem; padding: 0.8rem; }
.pin-back { margin-top: 0.5rem; width: 100%; }

/* -------------------------------------
   CLIENT HUB — ACTIVE & BLOCKED CARDS
------------------------------------- */
.card-active { cursor: pointer; }
.card-active:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}
.card-blocked {
  opacity: 0.7;
  cursor: default;
  background: #f8f9fa;
  border: 2px dashed #d1d5db;
}
.card-blocked:hover {
  transform: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.card-badge {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  z-index: 5;
}
.badge-active {
  background: #d1fae5;
  color: #065f46;
}
.badge-blocked {
  background: #fef3c7;
  color: #92400e;
}
.preview-btn {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s;
}
.card-blocked:hover .preview-btn { opacity: 1; }
