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

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

:root {
  --white: #FFFFFF;
  --dark-blue: #1A2B5F;
  --mid-blue: #2E5BFF;
  --amber: #F5A623;
  --amber-dark: #E09210;
  --gray-light: #F4F6FB;
  --gray-mid: #E2E8F0;
  --gray-text: #64748B;
  --danger: #EF4444;
  --success: #22C55E;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(30,43,95,.10);
  --shadow-lg: 0 8px 32px rgba(30,43,95,.16);
}

body { font-family: 'Inter', sans-serif; background: var(--gray-light); color: #1E293B; min-height: 100vh; }
h1,h2,h3,h4 { font-family: 'Poppins', sans-serif; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ── Header ── */
.header {
  background: var(--dark-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header__logo { font-family: 'Poppins', sans-serif; font-size: 1.5rem; font-weight: 800; }
.header__logo span { color: var(--amber); }
.header__actions { display: flex; align-items: center; gap: 16px; }
.header__credits { background: rgba(255,255,255,.12); border-radius: 8px; padding: 6px 14px; font-size: .875rem; font-weight: 600; }
.header__credits span { color: var(--amber); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 22px; border-radius: 8px; font-size: .9rem; font-weight: 600; transition: all .2s; }
.btn-primary { background: var(--mid-blue); color: var(--white); }
.btn-primary:hover { background: #1D47E8; }
.btn-amber { background: var(--amber); color: var(--dark-blue); }
.btn-amber:hover { background: var(--amber-dark); }
.btn-outline { background: transparent; border: 2px solid var(--white); color: var(--white); }
.btn-outline:hover { background: rgba(255,255,255,.12); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-ghost { background: transparent; color: var(--gray-text); }
.btn-ghost:hover { background: var(--gray-mid); color: #1E293B; }

/* ── Layout dashboard ── */
.layout { display: flex; min-height: 100vh; padding-top: 64px; }

.sidebar {
  width: 280px;
  background: var(--white);
  border-right: 1px solid var(--gray-mid);
  position: fixed;
  top: 64px; left: 0; bottom: 0;
  overflow-y: auto;
  padding: 24px 16px;
  z-index: 90;
}
.sidebar__title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gray-text); margin-bottom: 12px; padding: 0 8px; }
.professor-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 10px; cursor: pointer;
  transition: background .15s;
  margin-bottom: 4px;
}
.professor-card:hover { background: var(--gray-light); }
.professor-card.active { background: #EEF2FF; }
.professor-card__emoji { font-size: 1.8rem; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--gray-light); border-radius: 10px; flex-shrink: 0; }
.professor-card.active .professor-card__emoji { background: #C7D2FE; }
.professor-card__info { flex: 1; min-width: 0; }
.professor-card__name { font-weight: 600; font-size: .9rem; }
.professor-card__subject { font-size: .75rem; color: var(--gray-text); }

.main { margin-left: 280px; flex: 1; display: flex; flex-direction: column; min-height: calc(100vh - 64px); }

/* ── Chat area ── */
.chat-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-mid);
  padding: 16px 28px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 64px; z-index: 80;
}
.chat-header__emoji { font-size: 2rem; }
.chat-header__info h2 { font-size: 1.1rem; font-weight: 700; }
.chat-header__info p { font-size: .8rem; color: var(--gray-text); }
.chat-header__actions { margin-left: auto; display: flex; gap: 8px; }

.chat-messages { flex: 1; padding: 24px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; min-height: 0; }

.message { display: flex; gap: 12px; max-width: 780px; }
.message--user { flex-direction: row-reverse; align-self: flex-end; }
.message__avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.message--ai .message__avatar { background: #EEF2FF; }
.message--user .message__avatar { background: var(--mid-blue); color: var(--white); font-size: .9rem; font-weight: 700; }
.message__bubble { background: var(--white); border-radius: 16px; padding: 14px 18px; box-shadow: var(--shadow); line-height: 1.65; font-size: .9rem; max-width: 100%; }
.message--user .message__bubble { background: var(--mid-blue); color: var(--white); border-radius: 16px 4px 16px 16px; }
.message--ai .message__bubble { border-radius: 4px 16px 16px 16px; }
.message__bubble pre { background: #F1F5F9; border-radius: 6px; padding: 10px; overflow-x: auto; font-size: .8rem; margin: 8px 0; }
.message__bubble code { font-family: monospace; font-size: .85em; }
.message--user .message__bubble pre { background: rgba(255,255,255,.15); }

.typing-indicator { display: flex; gap: 5px; align-items: center; padding: 10px; }
.typing-indicator span { width: 8px; height: 8px; background: var(--gray-text); border-radius: 50%; animation: bounce .8s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: .15s; }
.typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }

.chat-input-area {
  background: var(--white);
  border-top: 1px solid var(--gray-mid);
  padding: 16px 28px;
}
.chat-input-wrap { display: flex; gap: 10px; align-items: flex-end; background: var(--gray-light); border-radius: 14px; padding: 10px 14px; border: 2px solid transparent; transition: border-color .2s; }
.chat-input-wrap:focus-within { border-color: var(--mid-blue); background: var(--white); }
.chat-input { flex: 1; border: none; background: transparent; resize: none; font-size: .9rem; max-height: 120px; min-height: 24px; outline: none; line-height: 1.5; }
.chat-send-btn { width: 40px; height: 40px; background: var(--mid-blue); color: white; border-radius: 10px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.chat-send-btn:hover { background: #1D47E8; }
.chat-send-btn svg { width: 18px; height: 18px; }

.welcome-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px; text-align: center; color: var(--gray-text);
}
.welcome-screen__emoji { font-size: 5rem; margin-bottom: 16px; }
.welcome-screen h2 { font-family: 'Poppins', sans-serif; color: var(--dark-blue); margin-bottom: 8px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--white); border-radius: 20px; max-width: 540px; width: 100%; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal__header { background: var(--dark-blue); color: white; padding: 24px 28px; }
.modal__header h2 { font-family: 'Poppins', sans-serif; }
.modal__body { padding: 24px 28px; }
.modal__footer { padding: 16px 28px; background: var(--gray-light); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Planos ── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 16px 0; }
.plan-card { border: 2px solid var(--gray-mid); border-radius: var(--radius); padding: 20px; text-align: center; position: relative; transition: border-color .2s; }
.plan-card:hover { border-color: var(--mid-blue); }
.plan-card--popular { border-color: var(--amber); }
.plan-card__badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--amber); color: var(--dark-blue); font-size: .7rem; font-weight: 800; padding: 4px 12px; border-radius: 20px; white-space: nowrap; }
.plan-card__price { font-family: 'Poppins', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--dark-blue); }
.plan-card__price span { font-size: 1rem; font-weight: 400; color: var(--gray-text); }
.plan-card__name { font-weight: 700; margin-bottom: 8px; color: var(--dark-blue); }
.plan-card__save { font-size: .75rem; color: var(--success); font-weight: 600; margin-bottom: 12px; }
.plan-card ul { text-align: left; font-size: .8rem; color: var(--gray-text); margin-bottom: 16px; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.plan-card ul li::before { content: '✓ '; color: var(--success); font-weight: 700; }

/* ── Auth pages ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--dark-blue) 0%, #2E3F8F 100%); padding: 16px; }
.auth-card { background: var(--white); border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-card__logo { font-family: 'Poppins', sans-serif; font-size: 2rem; font-weight: 800; color: var(--dark-blue); text-align: center; margin-bottom: 8px; }
.auth-card__logo span { color: var(--amber); }
.auth-card h2 { text-align: center; font-size: 1.1rem; color: var(--gray-text); margin-bottom: 28px; font-weight: 400; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-group input { width: 100%; padding: 11px 14px; border: 2px solid var(--gray-mid); border-radius: 10px; font-size: .9rem; transition: border-color .2s; }
.form-group input:focus { outline: none; border-color: var(--mid-blue); }
.auth-card .btn { width: 100%; margin-top: 8px; padding: 13px; font-size: 1rem; }
.auth-link { text-align: center; margin-top: 20px; font-size: .875rem; color: var(--gray-text); }
.auth-link a { color: var(--mid-blue); font-weight: 600; }
.form-error { background: #FEF2F2; color: var(--danger); border-radius: 8px; padding: 10px 14px; font-size: .85rem; margin-bottom: 16px; }

/* ── Landing page ── */
.landing-header { background: var(--dark-blue); padding: 0 32px; height: 68px; display: flex; align-items: center; justify-content: space-between; }
.landing-header__logo { font-family: 'Poppins', sans-serif; font-size: 1.6rem; font-weight: 800; color: var(--white); }
.landing-header__logo span { color: var(--amber); }
.landing-header__nav { display: flex; gap: 12px; }

.hero { background: linear-gradient(135deg, var(--dark-blue) 0%, #2A3E7A 100%); color: white; text-align: center; padding: 80px 32px; }
.hero h1 { font-family: 'Poppins', sans-serif; font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; margin-bottom: 16px; }
.hero h1 span { color: var(--amber); }
.hero p { font-size: 1.15rem; opacity: .85; max-width: 560px; margin: 0 auto 32px; line-height: 1.7; }
.hero__cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.section { padding: 64px 32px; max-width: 1100px; margin: 0 auto; }
.section__title { font-family: 'Poppins', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--dark-blue); text-align: center; margin-bottom: 8px; }
.section__sub { text-align: center; color: var(--gray-text); margin-bottom: 40px; }

.professors-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.professor-big-card { background: var(--white); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); text-align: center; transition: transform .2s, box-shadow .2s; }
.professor-big-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.professor-big-card__emoji { font-size: 3rem; margin-bottom: 12px; }
.professor-big-card h3 { font-size: 1rem; font-weight: 700; color: var(--dark-blue); margin-bottom: 4px; }
.professor-big-card p { font-size: .8rem; color: var(--gray-text); }

/* ── Perfil ── */
.profile-page { margin-left: 0; padding: 100px 32px 40px; max-width: 800px; margin: 0 auto; padding-top: 100px; }
.profile-card { background: var(--white); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); margin-bottom: 24px; }
.profile-card h3 { margin-bottom: 16px; color: var(--dark-blue); font-size: 1rem; border-bottom: 1px solid var(--gray-mid); padding-bottom: 10px; }
.profile-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-free { background: var(--gray-mid); color: var(--gray-text); }
.badge-semanal { background: #DBEAFE; color: #1D4ED8; }
.badge-mensal { background: #D1FAE5; color: #065F46; }
.badge-anual { background: linear-gradient(90deg, #FEF3C7, #FDE68A); color: #92400E; border: 1px solid var(--amber); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.stat-box { background: var(--gray-light); border-radius: 10px; padding: 16px; text-align: center; }
.stat-box__value { font-family: 'Poppins', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--dark-blue); }
.stat-box__label { font-size: .75rem; color: var(--gray-text); }

/* ── Conversas ── */
.conversations-page { padding: 100px 32px 40px; max-width: 900px; margin: 0 auto; }
.conversations-filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.conversations-filters input, .conversations-filters select { padding: 9px 14px; border: 2px solid var(--gray-mid); border-radius: 8px; font-size: .875rem; outline: none; transition: border-color .2s; }
.conversations-filters input:focus, .conversations-filters select:focus { border-color: var(--mid-blue); }
.conversation-item { background: var(--white); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 12px; display: flex; align-items: center; gap: 16px; transition: box-shadow .2s; }
.conversation-item:hover { box-shadow: var(--shadow-lg); }
.conversation-item__emoji { font-size: 1.8rem; }
.conversation-item__info { flex: 1; }
.conversation-item__title { font-weight: 600; margin-bottom: 4px; }
.conversation-item__meta { font-size: .78rem; color: var(--gray-text); }
.conversation-item__actions { display: flex; gap: 8px; }

/* ── Chat Público ── */
.public-page { display: flex; min-height: calc(100vh - 64px); padding-top: 64px; }
.public-sidebar { width: 260px; background: var(--white); border-right: 1px solid var(--gray-mid); padding: 24px 16px; position: fixed; top: 64px; bottom: 0; overflow-y: auto; }
.public-main { margin-left: 260px; flex: 1; padding: 28px 32px; max-width: 800px; }
.filter-btn { padding: 7px 16px; border-radius: 20px; font-size: .82rem; font-weight: 600; border: 2px solid var(--gray-mid); background: var(--white); transition: all .2s; margin-bottom: 6px; display: block; width: 100%; text-align: left; }
.filter-btn.active, .filter-btn:hover { border-color: var(--mid-blue); color: var(--mid-blue); background: #EEF2FF; }
.new-post-box { background: var(--white); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 24px; }
.new-post-box textarea { width: 100%; border: 2px solid var(--gray-mid); border-radius: 10px; padding: 12px; font-size: .9rem; resize: none; height: 80px; transition: border-color .2s; outline: none; }
.new-post-box textarea:focus { border-color: var(--mid-blue); }
.new-post-box__footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.post-card { background: var(--white); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.post-card__header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-card__avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--mid-blue); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.post-card__author { font-weight: 600; font-size: .9rem; }
.post-card__date { font-size: .75rem; color: var(--gray-text); }
.post-card__tag { font-size: .72rem; padding: 3px 10px; background: #EEF2FF; color: var(--mid-blue); border-radius: 20px; font-weight: 600; }
.post-card__content { line-height: 1.65; font-size: .9rem; margin-bottom: 14px; }
.post-card__actions { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--gray-mid); padding-top: 12px; }
.like-btn { display: flex; align-items: center; gap: 5px; color: var(--gray-text); font-size: .82rem; font-weight: 600; transition: color .2s; padding: 4px 10px; border-radius: 6px; background: none; }
.like-btn:hover, .like-btn.liked { color: var(--danger); }
.reply-toggle { display: flex; align-items: center; gap: 5px; color: var(--gray-text); font-size: .82rem; font-weight: 600; transition: color .2s; padding: 4px 10px; border-radius: 6px; background: none; }
.reply-toggle:hover { color: var(--mid-blue); }
.replies-section { margin-top: 14px; border-top: 1px solid var(--gray-light); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.reply-item { display: flex; gap: 10px; }
.reply-item__avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--gray-mid); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.reply-item__bubble { background: var(--gray-light); border-radius: 10px; padding: 8px 12px; font-size: .85rem; flex: 1; }
.reply-input-row { display: flex; gap: 8px; margin-top: 10px; }
.reply-input-row input { flex: 1; border: 1px solid var(--gray-mid); border-radius: 8px; padding: 8px 12px; font-size: .85rem; outline: none; }
.reply-input-row input:focus { border-color: var(--mid-blue); }

/* ── Suporte flutuante ── */
.support-fab { position: fixed; bottom: 28px; right: 28px; z-index: 150; }
.support-fab__btn { width: 56px; height: 56px; border-radius: 50%; background: var(--mid-blue); color: white; font-size: 1.4rem; box-shadow: var(--shadow-lg); display: flex; align-items: center; justify-content: center; transition: transform .2s, background .2s; }
.support-fab__btn:hover { background: #1D47E8; transform: scale(1.08); }
.support-fab__label { position: absolute; right: 64px; top: 50%; transform: translateY(-50%); background: var(--dark-blue); color: white; padding: 4px 10px; border-radius: 6px; font-size: .78rem; font-weight: 600; white-space: nowrap; }

.support-panel {
  position: fixed; right: 28px; bottom: 96px;
  width: 360px; max-height: 520px;
  background: var(--white); border-radius: 20px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  z-index: 150; overflow: hidden;
}
.support-panel__header { background: var(--dark-blue); color: white; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; }
.support-panel__header h3 { font-size: .95rem; font-weight: 700; }
.support-panel__close { background: none; color: white; font-size: 1.2rem; }
.support-panel__messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.support-panel__input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--gray-mid); }
.support-panel__input input { flex: 1; border: 1px solid var(--gray-mid); border-radius: 8px; padding: 9px 12px; font-size: .85rem; outline: none; }
.support-panel__input input:focus { border-color: var(--mid-blue); }
.support-panel__input button { background: var(--mid-blue); color: white; border-radius: 8px; padding: 9px 14px; font-size: .85rem; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1E293B; color: white; padding: 12px 20px; border-radius: 10px; font-size: .875rem; box-shadow: var(--shadow-lg); animation: fadeInUp .3s ease; }
.toast--success { background: var(--success); }
.toast--error { background: var(--danger); }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ── Nav links ── */
.nav-link { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 8px; font-size: .875rem; font-weight: 500; color: rgba(255,255,255,.75); transition: all .15s; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.12); }

/* ── Sidebar tabs ── */
.sidebar-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--gray-light); border-radius: 10px; padding: 4px; }
.sidebar-tab { flex: 1; padding: 7px; border-radius: 7px; font-size: .8rem; font-weight: 600; background: none; color: var(--gray-text); transition: all .15s; }
.sidebar-tab.active { background: var(--white); color: var(--dark-blue); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ── Histórico ── */
.historico-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.historico-item:hover { background: var(--gray-light); }
.historico-item__emoji { font-size: 1.4rem; flex-shrink: 0; }
.historico-item__info { flex: 1; min-width: 0; }
.historico-item__title { font-size: .83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.historico-item__meta { font-size: .72rem; color: var(--gray-text); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-mid); border-radius: 3px; }

/* ── Responsivo ── */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; top: 0; height: auto; border-right: none; border-bottom: 1px solid var(--gray-mid); }
  .layout { flex-direction: column; }
  .main { margin-left: 0; }
  .public-sidebar { display: none; }
  .public-main { margin-left: 0; padding: 16px; }
  .header { padding: 0 16px; }
  .support-panel { width: calc(100vw - 32px); right: 16px; }
  .plans-grid { grid-template-columns: 1fr; }
}
