/* ==========================================================
   Rolê — Design System (tema clean, inspirado no Instagram)
   ========================================================== */

:root {
  --color-primary: #0095F6;
  --color-primary-dark: #1877F2;
  --color-secondary: #385185;
  --color-secondary-light: #E8F0FE;
  --color-accent: #F5B921;
  --color-pink: #ED4956;

  --gradient-brand: var(--color-primary);
  --gradient-soft: #F0F2F5;

  --bg-app: #FAFAFA;
  --bg-card: #FFFFFF;
  --text-main: #262626;
  --text-muted: #8E8E8E;
  --border-soft: #DBDBDB;

  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-pill: 8px;

  --shadow-card: 0 0 0 1px rgba(0,0,0,0.06);
  --shadow-hover: 0 2px 10px rgba(0,0,0,0.10);
  --shadow-pop: none;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-main);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }

h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 .6em; line-height: 1.5; }

::selection { background: var(--color-secondary-light); color: var(--text-main); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #C7C7C7; border-radius: var(--radius-pill); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout ---------- */

.app-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

.app-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  padding-top: 20px;
}

@media (min-width: 1024px) {
  .app-grid.has-sidebar { grid-template-columns: 260px minmax(0, 1fr) 300px; }
}

.col-main { min-width: 0; }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}
.brand .brand-emoji { font-size: 1.3rem; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-main);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--gradient-soft); }

.badge-count {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--color-pink);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 17px; height: 17px;
  border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-card);
}

/* ---------- Sidebar menu ---------- */

.side-nav {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 10px;
  position: sticky;
  top: 78px;
  height: fit-content;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 2px;
  transition: background .15s ease;
}
.side-nav a .nav-emoji { font-size: 1.1rem; }
.side-nav a:hover { background: var(--gradient-soft); }
.side-nav a.active {
  background: var(--gradient-soft);
  color: var(--text-main);
  font-weight: 700;
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin-bottom: 18px;
  animation: fadeInUp .3s ease both;
}

.card-title { font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background .15s ease, opacity .15s ease;
}
.btn:active { opacity: 0.85; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-secondary { background: var(--gradient-soft); color: var(--text-main); }
.btn-secondary:hover { background: #E4E6E9; }

.btn-ghost { background: transparent; color: var(--text-main); }
.btn-ghost:hover { background: var(--gradient-soft); }

.btn-danger { background: #FDEDEE; color: var(--color-pink); }
.btn-danger:hover { background: #FBD9DC; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #131314;
  color: #fff;
  border: 1px solid #2a2a2c;
  border-radius: var(--radius-pill);
  padding: 11px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  transition: background .15s ease;
}
.btn-google:hover { background: #1f1f21; }
.btn-google svg { flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 18px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

/* ---------- Forms ---------- */

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.85rem; color: var(--text-muted); }

.form-control {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0,149,246,0.12);
}
textarea.form-control { resize: vertical; min-height: 90px; }
.field-error { color: var(--color-pink); font-size: 0.8rem; margin-top: 4px; }

/* ---------- Avatars ---------- */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--gradient-soft);
  flex-shrink: 0;
}
.avatar-online { position: relative; }
.avatar-online::after {
  content: '';
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: #2ECC71;
  border: 2px solid #fff;
  border-radius: 50%;
}

/* ---------- Post composer ---------- */

.composer-head { display: flex; align-items: center; gap: 12px; }
.composer-input {
  flex: 1;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  padding: 11px 16px;
  background: var(--bg-app);
  font-family: inherit;
  cursor: pointer;
  color: var(--text-muted);
}
.composer-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.composer-actions .btn-ghost { border: 1px solid var(--border-soft); }

/* ---------- Feed post ---------- */

.post-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.post-author { font-weight: 700; }
.post-meta { color: var(--text-muted); font-size: 0.8rem; }
.post-content { font-size: 0.95rem; white-space: pre-wrap; }
.post-media { border-radius: var(--radius-md); overflow: hidden; margin: 12px 0; }
.post-media img, .post-media video { width: 100%; max-height: 520px; object-fit: cover; }

.tag-link { color: var(--color-primary); font-weight: 600; }
.tag-link:hover { text-decoration: underline; }

.post-stats { display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 0.8rem; padding: 8px 0; }
.reaction-summary { display: flex; gap: 6px; flex-wrap: wrap; }
.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--gradient-soft);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}
.post-actions { display: flex; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); padding: 4px 0; margin-bottom: 10px; }
.post-actions form { flex: 1; }
.post-action-btn {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s ease;
}
.post-action-btn:hover { background: var(--gradient-soft); }
.post-action-btn.active { color: var(--color-pink); }
.post-action-btn.liked-pop { animation: heartBeat .4s ease; }

.reaction-picker { display: flex; gap: 2px; }
.reaction-picker button {
  border: none; background: transparent; font-size: 1.15rem; border-radius: var(--radius-pill);
  padding: 4px 6px; transition: transform .12s ease;
}
.reaction-picker button:hover { transform: scale(1.2); }

/* ---------- Comments ---------- */

.comment { display: flex; gap: 10px; margin-bottom: 10px; }
.comment-bubble { background: var(--bg-app); border-radius: var(--radius-md); padding: 8px 14px; flex: 1; }
.comment-author { font-weight: 600; font-size: 0.85rem; }
.comment-text { font-size: 0.9rem; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { flex: 1; }

/* ---------- Mensagens / chat ---------- */

.msg-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-end; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-bubble {
  max-width: 70%;
  background: var(--gradient-soft);
  border-radius: 14px;
  padding: 8px 12px;
}
.msg-row.mine .msg-bubble { background: var(--color-primary); color: #fff; }
.msg-text { font-size: 0.9rem; white-space: pre-wrap; }
.msg-row.mine .tag-link { color: #fff; text-decoration: underline; }
.msg-time { font-size: 0.66rem; opacity: 0.65; margin-top: 2px; text-align: right; }
.msg-media { margin-bottom: 4px; }
.msg-media img, .msg-media video { max-width: 220px; max-height: 240px; border-radius: 10px; display: block; }

/* ---------- Pills / tags ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--gradient-soft); color: var(--text-main);
  border-radius: var(--radius-pill); padding: 4px 11px; font-size: 0.76rem; font-weight: 600;
}

/* ---------- Sidebar widgets ---------- */

.widget-list { display: flex; flex-direction: column; gap: 10px; }
.widget-row { display: flex; align-items: center; gap: 10px; }
.widget-row .name { font-weight: 600; font-size: 0.88rem; }
.widget-row .sub { font-size: 0.76rem; color: var(--text-muted); }

.pet-of-day-card { text-align: center; }
.pet-of-day-photo {
  width: 100%; height: 160px; object-fit: cover; border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
}

/* ---------- Empty / coming soon ---------- */

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .emoji { font-size: 3rem; display: block; margin-bottom: 10px; }

/* ---------- Flash messages / toasts ---------- */

.flash-stack {
  position: fixed; top: 78px; right: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 320px;
}
.flash {
  padding: 13px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  font-weight: 600;
  font-size: 0.88rem;
  animation: slideIn .3s ease both;
  color: #fff;
}
.flash-success { background: #2ECC71; }
.flash-error { background: var(--color-pink); }

/* ---------- Mobile bottom nav ---------- */

.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-soft);
  z-index: 45;
  padding: 6px 4px;
}
.mobile-nav ul { display: flex; justify-content: space-around; }
.mobile-nav a { display: flex; flex-direction: column; align-items: center; font-size: 0.62rem; color: var(--text-muted); gap: 2px; padding: 4px 6px; }
.mobile-nav a.active { color: var(--text-main); font-weight: 700; }
.mobile-nav .nav-emoji { font-size: 1.2rem; }

@media (max-width: 780px) {
  .side-nav { display: none; }
  .mobile-nav { display: block; }
  .app-grid { grid-template-columns: 1fr; padding-bottom: 70px; }
  .sidebar-right { order: 3; }
}

/* ---------- Animations ---------- */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.25); }
  60% { transform: scale(0.95); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
