@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; }
}
