:root {
    /* DARK THEME */
    --bg-main: HSL(145, 12%, 7%);
    --bg-panel: rgba(22, 33, 26, 0.45);
    --accent-mint: HSL(150, 80%, 46%);
    --accent-emerald: HSL(160, 95%, 42%);
    --text-primary: HSL(0, 0%, 96%);
    --text-muted: HSL(145, 8%, 68%);
    --glass-border: rgba(150, 250, 200, 0.08);
    --input-bg: rgba(0, 0, 0, 0.25);
    --danger: #ef4444;
    --font-outfit: 'Outfit', sans-serif;
}

[data-theme="light"] {
    /* LIGHT THEME */
    --bg-main: #f0fdf4;
    --bg-panel: rgba(255, 255, 255, 0.85);
    --accent-mint: #16a34a;
    --accent-emerald: #22c55e;
    --text-primary: #064e3b;
    --text-muted: #166534;
    --glass-border: rgba(34, 197, 94, 0.3);
    --input-bg: rgba(255, 255, 255, 0.6);
    --danger: #dc2626;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font-outfit); }

body { background-color: var(--bg-main); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; transition: 0.4s; }

/* Fundo */
.leaves-background { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; opacity: 0.5; }
[data-theme="light"] .leaves-background { background: radial-gradient(circle at 50% 50%, #dcfce7 0%, #f0fdf4 100%); opacity: 1; }
.leaf { position: absolute; width: 40px; height: 40px; background: var(--accent-mint); clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 50% 85%, 18% 100%, 0% 38%); opacity: 0.2; }
.leaf-1 { top: 15%; left: 10%; animation: float 12s infinite ease-in-out alternate; }
.leaf-2 { top: 75%; left: 80%; animation: float 16s infinite ease-in-out alternate; }
@keyframes float { 0% { transform: translateY(0) rotate(0deg); } 100% { transform: translateY(-40px) rotate(350deg); } }

/* Glassmorphism */
.glass-panel { background: var(--bg-panel); backdrop-filter: blur(16px); border: 1px solid var(--glass-border); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1); border-radius: 20px; transition: 0.3s; }

/* Botões e Inputs Básicos */
.btn-primary { background: linear-gradient(135deg, var(--accent-mint) 0%, var(--accent-emerald) 100%); border: none; color: #fff; font-weight: 700; font-size: 1.05rem; padding: 14px 28px; border-radius: 14px; cursor: pointer; transition: 0.3s; width: 100%; margin-top: 10px; }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-sm { padding: 10px 20px; font-size: 0.9rem; width: auto; margin-top: 0; }
.link-btn { background: none; border: none; color: var(--accent-mint); font-weight: 600; cursor: pointer; text-decoration: underline; }
.icon-action-btn { background: var(--input-bg); border: 1px solid var(--glass-border); width: 40px; height: 40px; border-radius: 50%; color: var(--text-primary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s;}
.icon-action-btn:hover { border-color: var(--accent-mint); color: var(--accent-mint); }
.floating-theme-btn { position: absolute; top: 20px; right: 20px; z-index: 100; }

/* Autenticação */
.auth-section { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; position: relative; }
.auth-card { width: 100%; max-width: 450px; padding: 40px; text-align: center; }
.logo-container { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.logo-title { font-size: 2.2rem; font-weight: 800; }
.logo-title span { color: var(--accent-mint); }
.auth-subtitle { color: var(--text-muted); margin-bottom: 25px; }

.form-group { display: flex; flex-direction: column; gap: 8px; text-align: left; margin-bottom: 15px; }
.form-group label { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }

.form-group input, textarea { background: var(--input-bg); border: 1px solid var(--glass-border); border-radius: 10px; padding: 12px; color: var(--text-primary); width: 100%; font-size: 0.95rem; resize: none; }
.form-group input:focus, textarea:focus { outline: none; border-color: var(--accent-mint); }

.password-input-wrapper { position: relative; display: flex; align-items: center; }
.toggle-password { position: absolute; right: 14px; background: none; border: none; color: var(--text-muted); cursor: pointer; }

/* Dashboard / Layout Base */
.app-container { max-width: 800px; margin: 0 auto; padding: 100px 20px 20px; }
.app-header { position: fixed; top: 20px; left: 20px; right: 20px; max-width: 1000px; margin: 0 auto; height: 70px; display: flex; justify-content: space-between; align-items: center; padding: 0 30px; z-index: 100; border-radius: 14px; }
.app-header-left { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; }
.app-header-left span span { color: var(--accent-mint); }

/* Navegação */
.app-nav { display: flex; gap: 10px; }
.nav-btn { background: none; border: none; color: var(--text-muted); font-size: 1rem; font-weight: 600; padding: 8px 16px; cursor: pointer; border-radius: 20px; transition: 0.3s; display: flex; gap: 8px; align-items: center; }
.nav-btn:hover { color: var(--text-primary); background: var(--input-bg); }
.nav-btn.active { color: #fff; background: var(--accent-mint); }

.app-header-right { display: flex; align-items: center; gap: 15px; }
.user-header-profile { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 15px; background: var(--input-bg); border-radius: 20px; position: relative; }
.profile-dropdown { position: absolute; top: 50px; right: 0; padding: 10px; width: 150px; display: flex; flex-direction: column; }
.dropdown-item { background: none; border: none; padding: 10px; color: var(--text-primary); cursor: pointer; text-align: left; }
.dropdown-item:hover { color: var(--danger); }

/* Área de Criação de Post */
.create-post-card { padding: 25px; margin-bottom: 30px; }
.create-post-card h3 { margin-bottom: 15px; font-size: 1.1rem; }
.post-actions-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; }
.upload-btn { color: var(--accent-mint); font-weight: 600; cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 0.95rem; }
.upload-btn:hover { color: var(--accent-emerald); }
.file-name { font-size: 0.8rem; color: var(--text-muted); margin-left: 10px; }

/* Posts Feed e Cards */
.posts-container { display: flex; flex-direction: column; gap: 20px; }
.post-card { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.post-header { display: flex; justify-content: space-between; align-items: center; }
.post-author { font-weight: 700; display: flex; flex-direction: column; }
.post-author-name-row { display: flex; align-items: center; gap: 10px; }
.btn-follow { background: var(--input-bg); border: 1px solid var(--glass-border); color: var(--text-primary); padding: 2px 8px; font-size: 0.7rem; border-radius: 10px; cursor: pointer; transition: 0.2s; }
.btn-follow:hover { border-color: var(--accent-mint); color: var(--accent-mint); }
.btn-follow.following { background: var(--accent-mint); border-color: var(--accent-mint); color: white; }

.post-date { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.btn-delete-post { background: none; border: none; color: var(--text-muted); cursor: pointer; transition: 0.2s; font-size: 1.1rem; }
.btn-delete-post:hover { color: var(--danger); }
.post-content-text { font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; }
.post-media-container { width: 100%; max-height: 400px; border-radius: 10px; overflow: hidden; background: rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center;}
.post-media-container img, .post-media-container video { max-width: 100%; max-height: 400px; object-fit: contain; }

/* Ações do Post */
.post-interaction-bar { display: flex; gap: 20px; border-top: 1px solid var(--glass-border); border-bottom: 1px solid var(--glass-border); padding: 10px 0; }
.interaction-btn { background: none; border: none; color: var(--text-muted); font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 0.95rem; transition: 0.2s;}
.interaction-btn:hover { color: var(--text-primary); }
.interaction-btn.liked { color: var(--accent-mint); }
.interaction-btn.liked i { animation: pop 0.3s ease; }
@keyframes pop { 50% { transform: scale(1.3); } }

/* Comentários */
.comments-section { display: flex; flex-direction: column; gap: 15px; padding-top: 5px; }
.comment-item { background: var(--input-bg); padding: 12px; border-radius: 10px; }
.comment-author { font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; display: flex; justify-content: space-between;}
.comment-text { font-size: 0.9rem; }
.add-comment-form { display: flex; gap: 10px; }
.add-comment-form input { flex: 1; padding: 10px; border-radius: 20px; background: var(--input-bg); border: 1px solid var(--glass-border); color: var(--text-primary); }
.add-comment-form button { background: var(--accent-mint); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }

/* Perfil & Estatísticas */
.profile-info-card { padding: 30px; text-align: center; margin-bottom: 30px; }
.profile-avatar { width: 80px; height: 80px; background: var(--accent-mint); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #fff; margin: 0 auto 15px; overflow: hidden; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-date { color: var(--text-muted); font-size: 0.9rem; margin-top: 5px; }
.profile-stats-grid { display: flex; justify-content: center; gap: 20px; margin: 20px 0; padding-top: 15px; border-top: 1px solid var(--glass-border); }
.stat-box { display: flex; flex-direction: column; align-items: center; background: var(--input-bg); padding: 10px 20px; border-radius: 14px; min-width: 100px; }
.stat-number { font-size: 1.4rem; font-weight: 800; color: var(--accent-mint); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* Hábitos e Fórum */
.habit-btn { background: var(--input-bg); border: 1px solid var(--glass-border); padding: 15px; border-radius: 10px; color: var(--text-primary); text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 1rem; transition: 0.2s; }
.habit-btn:hover { border-color: var(--accent-mint); }
.habit-log-item { display: flex; justify-content: space-between; font-size: 0.9rem; padding: 10px; border-bottom: 1px dashed var(--glass-border); }
.habit-log-item span { color: var(--accent-mint); font-weight: bold; }

.section-title { margin-bottom: 15px; color: var(--accent-mint); border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px; background: var(--input-bg); border-radius: 14px; border: 1px dashed var(--glass-border); }

/* Utilitários */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.4s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Toasts */
.notification-toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; }
.toast { background: var(--bg-panel); border-left: 4px solid var(--accent-mint); padding: 15px; border-radius: 8px; margin-top: 10px; color: var(--text-primary); box-shadow: 0 4px 10px rgba(0,0,0,0.2); display: flex; gap: 10px; align-items: center;}
.toast.error { border-left-color: var(--danger); }