/* ===== VARIÁVEIS CSS ===== */
:root {
    --primary: #4A90E2;
    --secondary: #50E3C2;
    --accent: #F5A623;
    --bg-light: #F5F7FA;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --transition: all 0.3s ease;
}

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

html,
body {
    width: 100%;
    height: 100%;
    -webkit-text-size-adjust: 100%;
    /* Prevent font scaling quirks */
    text-size-adjust: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 16px;
    /* Explicit base font size */
}

/* ===== TIPOGRAFIA ===== */
h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 32px;
    font-weight: bold;
    color: var(--text-dark);
}

h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
}

h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

p {
    font-size: 16px;
    color: var(--text-light);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary);
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== HEADER ===== */
header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    gap: 30px;
    align-items: center;
    list-style: none;
}

.nav-menu a {
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
}

.nav-menu a:hover {
    color: var(--primary);
}


.notification-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: var(--transition);
    border: none;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
}

.notification-link:hover {
    background-color: var(--bg-light);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #ff4757;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}

/* Notification Popup (Facebook Style) */
.notification-popup {
    position: absolute;
    top: 50px;
    right: -10px;
    width: 360px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    z-index: 99999;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    max-height: 500px;
    overflow-y: auto;
}

.notification-popup.active {
    display: flex;
}

.notification-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 18px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}

.notification-header {
    padding: 12px 15px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notification-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--bg-light);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    transition: background 0.2s;
    position: relative;
}

.notification-item:hover {
    background-color: #f0f2f5;
}

.notification-item.unread {
    background-color: #e7f3ff;
}

.notification-item.unread:hover {
    background-color: #dbeaff;
}

.notification-content {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.notification-time {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
    display: block;
}

.notification-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.notification-item:hover .notification-actions {
    opacity: 1;
}


.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.user-avatar:hover {
    transform: scale(1.1);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* User Dropdown */
.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 40px;
    /* Alinhado ao fundo do avatar */
    right: 0;
    background: white;
    min-width: 200px;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    padding: 8px 0;
    z-index: 9999;
    margin-top: 5px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.2s ease;
}

/* Ponte invisível maior para o mouse não "cair" no buraco */
.user-dropdown::before {
    content: '';
    position: absolute;
    top: -20px;
    right: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.user-menu:hover .user-dropdown {
    display: flex;
}

.user-dropdown-item {
    padding: 12px 20px;
    color: var(--text-dark);
    font-size: 14px;
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.user-dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}


/* ===== BOTÕES ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #3A8BC1;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: transparent;
    color: var(--secondary);
    border: 2px solid var(--secondary);
}

.btn-secondary:hover {
    background: var(--secondary);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== FORMULÁRIOS ===== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    transition: var(--transition);
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ===== LAYOUT PRINCIPAL ===== */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    padding: 30px 0;
}

.feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== CARD DE POSTAGEM ===== */
.post-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: var(--transition);
}

.post-card:hover {
    box-shadow: var(--shadow-lg);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.post-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.post-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.post-info {
    flex: 1;
}

.post-author {
    font-weight: 600;
    color: var(--text-dark);
}

.post-author a {
    color: var(--primary);
}

.post-time {
    font-size: 12px;
    color: var(--text-light);
}

.post-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.post-content {
    font-size: 16px;
    color: var(--text-dark);
    margin-bottom: 15px;
    line-height: 1.6;
}

.post-content a {
    color: var(--primary);
    text-decoration: underline;
}

.post-image {
    display: block;
    width: 100%;
    margin: 0 0 15px 0;
    border-radius: var(--radius);
    max-height: none;
    object-fit: cover;
    cursor: zoom-in;
}

.post-link-preview {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 15px;
    transition: var(--transition);
}

.post-link-preview:hover {
    border-color: var(--primary);
}

.link-preview-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.link-preview-content {
    padding: 12px;
}

.link-preview-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.link-preview-description {
    font-size: 14px;
    color: var(--text-light);
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.post-stats {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--text-light);
}

.post-actions {
    display: flex;
    gap: 10px;
}

.post-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-action-btn:hover {
    color: var(--primary);
}

.post-action-btn.liked {
    color: #FF4757 !important;
    animation: heartBeat 0.3s ease-out;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.post-action-btn.processing {
    opacity: 0.6;
    pointer-events: none;
}

/* ===== FORMULÁRIO DE POSTAGEM ===== */
.post-form-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.post-form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.post-form-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post-form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
}

.post-form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.post-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-form-tools {
    display: flex;
    gap: 10px;
}

.post-form-tool-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 18px;
    transition: var(--transition);
}

.post-form-tool-btn:hover {
    color: var(--secondary);
    transform: scale(1.1);
}

/* ===== SEÇÃO DE COMENTÁRIOS ===== */
.comments-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.comment {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.comment-content {
    flex: 1;
    background: var(--bg-light);
    padding: 12px;
    border-radius: var(--radius);
}

.comment-author {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.comment-author a {
    color: var(--primary);
}

.comment-text {
    font-size: 14px;
    color: var(--text-dark);
}

.comment-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
}

.comment-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}

.comment-action-btn:hover {
    color: var(--primary);
}

/* ===== WIDGET DA SIDEBAR ===== */
.widget {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.widget-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.widget-list {
    list-style: none;
}

.widget-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.widget-item:last-child {
    border-bottom: none;
}

.widget-item a {
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
}

.widget-item a:hover {
    color: var(--primary);
}

/* ===== PERFIL DE USUÁRIO ===== */
.profile-header {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
}

.profile-cover {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius);
    margin-bottom: -50px;
    position: relative;
}

.profile-info {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    border: 4px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: bold;
    color: var(--primary);
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-details {
    flex: 1;
}

.profile-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
}

.profile-username {
    color: var(--text-light);
    font-size: 14px;
}

.profile-bio {
    color: var(--text-dark);
    margin-top: 8px;
}

.profile-stats {
    display: flex;
    gap: 30px;
    margin-top: 15px;
}

.profile-stat {
    text-align: center;
}

.profile-stat-number {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary);
}

.profile-stat-label {
    font-size: 12px;
    color: var(--text-light);
}

.profile-actions {
    display: flex;
    gap: 10px;
}

/* ===== CHAT FLUTUANTE ===== */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-header {
    background: var(--primary);
    color: white;
    padding: 15px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-title {
    font-weight: 600;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.chat-message.sent {
    justify-content: flex-end;
}

.chat-message-content {
    max-width: 70%;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 14px;
}

.chat-message.received .chat-message-content {
    background: var(--bg-light);
    color: var(--text-dark);
}

.chat-message.sent .chat-message-content {
    background: var(--primary);
    color: white;
}

.chat-input {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
}

.chat-input button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 10px 15px;
    cursor: pointer;
    transition: var(--transition);
}

.chat-input button:hover {
    background: #3A8BC1;
}

.chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 999;
}

.chat-fab:hover {
    transform: scale(1.1);
    background: #3A8BC1;
}

.chat-fab.hidden {
    display: none;
}

/* ===== NOTIFICAÇÕES ===== */
.notification {
    background: white;
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: var(--text-dark);
}

.notification-message {
    font-size: 14px;
    color: var(--text-light);
}

/* ===== RESPONSIVO (MOBILE FIRST OPTIMIZATIONS) ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
        /* Reduced container padding */
    }

    /* Header Compacto Mobile */
    .header-content {
        flex-direction: column;
        /* Stack logo and buttons */
        padding: 15px 0;
        gap: 10px;
    }

    .logo {
        font-size: 1.4rem;
        /* Slightly larger for readability */
        width: 100%;
        text-align: center;
    }

    .logo a {
        display: flex;
        justify-content: center;
        /* Center logo */
        align-items: center;
        gap: 5px;
    }

    .user-menu {
        width: 100%;
        justify-content: center;
        /* Center buttons */
    }

    /* Hide large nav, keep user menu */
    .nav-menu {
        display: none;
    }

    .sidebar {
        display: none;
    }

    .main-layout {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px 0;
    }

    html,
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        position: relative;
    }

    /* POST CARD OPTIMIZATIONS */
    .post-card {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 12px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        /* Softer shadow */
    }

    .post-header {
        margin-bottom: 12px;
    }

    .post-avatar {
        width: 40px;
        height: 40px;
    }

    .post-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Mobile Typography & Readability Improvements */
    .post-author {
        font-size: 17px;
        /* Larger author name */
        line-height: 1.3;
        font-weight: 600;
    }

    .post-time {
        font-size: 13px;
        /* More readable timestamp */
        color: #888;
    }

    .post-content {
        font-size: 17px;
        /* Crucial: Larger body text for mobile */
        margin-bottom: 12px;
        line-height: 1.6;
        color: #333;
        /* Ensure high contrast */
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Content Media - Restrict height on mobile */
    .post-image {
        border-radius: 8px;
        width: 100%;
        /* Full width of card */
        height: auto;
        max-height: 400px;
        /* Prevent gigantic vertical images */
        object-fit: contain;
        /* Ensure text/content in image is readable without crop */
        background-color: #f8f9fa;
        /* Light background for non-square aspect ratios */
        margin-bottom: 12px;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    /* Fix video adaptation (User reported cut off / only half appearing) */
    body .lp-ytplayer {
        /* Stronger selector */
        border-radius: 8px;
        width: 100% !important;
        max-width: 100% !important;
        /* Ensure it stays within parent */
        aspect-ratio: 16 / 9 !important;
        height: auto !important;
        margin: 0 0 12px 0 !important;
        /* Reset side margins to 0 */
        background: #000;
        display: block !important;
        box-shadow: none !important;
    }

    .lp-ytplayer iframe,
    .lp-ytplayer img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover;
    }

    /* Post Link Preview */
    .post-link-preview {
        flex-direction: column;
    }

    .link-preview-image {
        height: 160px;
    }

    /* POST FOOTER (Stacked for Action Buttons) */
    .post-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
    }

    /* Stats Line */
    .post-stats {
        width: 100%;
        justify-content: space-between;
        font-size: 12px;
        color: #888;
        padding-bottom: 8px;
        border-bottom: 1px dashed #eee;
    }

    /* Action Buttons Row */
    .post-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        /* Spread buttons */
        gap: 8px;
    }

    .post-action-btn {
        flex: 1;
        /* Equal width buttons */
        justify-content: center;
        padding: 10px 0;
        /* Taller touch target */
        background-color: #f5f7fa;
        /* Light bg for tap area visibility */
        border-radius: 8px;
        font-weight: 600;
        font-size: 13px;
    }

    .post-action-btn:active {
        background-color: #eef0f3;
        transform: scale(0.98);
    }

    /* POST FORM MOBILE */
    .post-form-card {
        padding: 15px;
    }

    .post-form-header h3 {
        font-size: 15px;
    }

    .post-form-input {
        min-height: 80px;
    }

    .post-form-actions {
        flex-direction: row;
        align-items: center;
        width: 100%;
    }

    .post-form-tools {
        gap: 15px;
    }

    .post-form-tool-btn {
        font-size: 20px;
        /* Bigger icons */
        padding: 5px;
    }

    .btn.btn-small {
        margin-left: auto;
        /* Push to right */
    }

    /* PROFILE MOBILE */
    .profile-header {
        padding: 15px;
    }

    .profile-cover {
        height: 120px;
        margin-bottom: -40px;
    }

    .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
        border-width: 3px;
        font-size: 30px;
    }

    .profile-details {
        width: 100%;
    }

    .profile-bio {
        font-size: 14px;
    }

    .profile-stats {
        justify-content: center;
        gap: 20px;
        margin: 15px 0;
    }

    .profile-stat-number {
        font-size: 18px;
    }

    .profile-actions {
        justify-content: center;
        width: 100%;
    }

    .profile-actions .btn {
        flex: 1;
    }

    /* Chat Widget Mobile */
    .chat-widget {
        width: calc(100% - 30px);
        right: 15px;
        bottom: 80px;
        /* Above FAB */
        max-height: 50vh;
    }

    .chat-fab {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 20px;
        right: 20px;
    }
}

/* ===== UTILITÁRIOS ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-light);
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.gap-20 {
    gap: 20px;
}

.mention {
    color: var(--primary);
    font-weight: 500;
}

.mention:hover {
    text-decoration: underline;
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideUp 0.3s ease;
}

/* ===== MODAL DE IMAGEM (PREMIUM) ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: flex-start;
    /* Permite scroll no topo */
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    /* Scroll para imagens longas */
    padding: 40px 10px;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-container {
    position: relative;
    width: 98%;
    max-width: 1400px;
    /* Permitir zoom bem maior */
    transform: scale(0.95);
    transition: transform 0.3s ease-out;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    display: block;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-dark);
    font-weight: bold;
    border: none;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--primary);
    color: white;
    transform: rotate(90deg);
}

/* Cursor pointer para imagens que podem ser ampliadas */
.post-image {
    cursor: pointer;
    /* Ensure image fits container */
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    display: block;
}

/* Post Card Constraints */
.post-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid transparent;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* IMPORTANT */
}

/* ===== MOBILE IN-FEED ADS ===== */
.feed-ad-banner {
    display: none;
    /* Hidden by default on desktop */
}

@media (max-width: 768px) {
    .feed-ad-banner {
        display: block;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 15px;
        position: relative;
        overflow: hidden;
        /* Ensure content stays within rounded corners */
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        /* Ensure it doesn't overflow viewport */
    }

    .feed-ad-banner::before {
        content: 'Publicidade';
        position: absolute;
        top: 5px;
        right: 10px;
        font-size: 10px;
        color: #999;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .feed-ad-content {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .feed-ad-title {
        font-weight: 600;
        font-size: 14px;
        color: #333;
    }

    .feed-ad-image {
        width: auto;
        max-width: 100%;
        max-height: 350px;
        /* Limit height to avoid scrolling issues with vertical banners */
        border-radius: 8px;
        object-fit: contain;
        /* Ensure full ad is visible */
        display: block;
        margin: 0 auto;
        /* Center the image */
        background: #f9f9f9;
        /* Fallback background for transparent images */
    }
}

/* ===== ACTION TOOLBAR ===== */
.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
    margin-top: 10px;
}

.post-actions-toolbar {
    display: flex;
    gap: 15px;
    align-items: center;
}

.action-item {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    transition: background 0.2s, transform 0.1s;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
}

.action-item:hover {
    background-color: #f3f4f6;
}

.action-item:active {
    transform: scale(0.95);
}

.action-item.liked {
    color: #e0245e;
}

.action-item.delete-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

.action-item.disabled {
    cursor: default;
    opacity: 0.7;
}

.action-item .label {
    margin-left: 4px;
    display: none;
    /* Hidden by default on smallest screens if needed, or show? User wants intuitive. */
    display: inline-block;
}

@media (max-width: 480px) {
    .action-item .label {
        display: none;
        /* Hide labels on very small mobile to fit toolbar */
    }

    .post-actions-toolbar {
        gap: 10px;
        justify-content: space-between;
        width: 100%;
        padding-right: 10px;
    }

    .post-views-stat {
        display: none;
        /* Hide views on mobile to save space */
    }
}

/* Fix Load More Layout Bug */
#feedContainer {
    min-height: 100vh;
    /* Ensure container has height */
    overflow: visible;
    /* Prevent clipping */
}


/* ===== COMMENT PREVIEW REFINEMENTS ===== */
.post-comments-preview {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 12px;
    margin-top: 12px;
    border: 1px solid #edf2f7;
}

.preview-comment {
    font-size: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    color: var(--text-dark);
    line-height: 1.5;
    position: relative;
    user-select: text;
    /* Allow copying text */
}

/* Allow link clicks */
.preview-comment a {
    color: var(--primary);
    text-decoration: underline;
    position: relative;
    z-index: 10;
}

.preview-comment a:hover {
    text-decoration: none;
}

.preview-comment strong {
    font-weight: 700;
    margin-right: 5px;
    color: #2d3748;
}

.view-all-comments {
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
    margin-top: 10px;
    font-weight: 600;
    display: inline-block;
}

.view-all-comments:hover {
    text-decoration: underline;
}

/* ===== TOAST NOTIFICATION ===== */
.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    /* Let clicks pass through if hidden */
}

.toast-notification.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ===== MODAL EXTRAS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    /* Mobile safe area */
}

/* Ensure Modal doesn't overflow on mobile */
.modal-container {
    width: 100%;
    max-width: 550px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2d3748;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.comments-list-modal {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    min-height: 100px;
    /* Ensure some space even if empty */
}

.comment-input-area {
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-option-btn {
    display: block;
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    text-align: left;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-option-btn:hover {
    background: #eef2f7;
    border-color: var(--primary);
    transform: translateX(5px);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== LAYOUT GRID FIXES ===== */
/* Enforce robust layout to prevent expansion/breaking on load more */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (min-width: 992px) {
    .main-layout {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: 24px;
        align-items: start;
    }

    .feed {
        min-width: 0;
        /* CRITICAL: Prevents grid item from expanding beyond its cell */
        width: 100%;
    }

    .sidebar {
        position: static;
        width: 100%;
    }
}

@media (max-width: 991px) {
    .main-layout {
        display: flex;
        flex-direction: column;
    }

    .sidebar {
        display: none;
        /* Often sidebars are hidden on smaller screens or moved */
    }
}

/* Ensure Feed Container respects width */
#feedContainer {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    /* Prevent horizontal scroll causing layout reflow */
}

/* Helper to constrain contents */
.post-card,
.post-content,
.post-text-content,
.link-preview-content {
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

/* ===== MODAL Z-INDEX FIX ===== */
/* Fix conflict with YouTube players */
.modal-overlay {
    z-index: 10000 !important;
}

.modal-container {
    z-index: 10001 !important;
}

.lp-ytplayer {
    z-index: 1 !important;
    position: relative;
}

/* ===== MOBILE HEADER OPTIMIZATION ===== */
@media (max-width: 768px) {

    /* Compact Header */
    .header-content {
        padding: 5px 0 !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px;
    }

    /* Reduce Logo Size & Force line limit */
    .logo {
        font-size: 15px !important;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
        margin-right: auto;
        /* Push everything else to right */
        text-align: left;
    }

    .logo a {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide Desktop Nav completely */
    .nav-menu {
        display: none !important;
    }

    /* User Menu adjustments */
    .user-menu {
        gap: 8px !important;
        flex-shrink: 0;
        /* Prevent shrinking */
        margin-left: 0;
    }

    /* Make User Avatar Smaller */
    .user-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
        border-radius: 50%;
    }

    /* Notification Bell adjustment */
    .notification-link {
        width: 32px !important;
        height: 32px !important;
    }

    .notification-link .icon {
        font-size: 1rem !important;
    }

    /* Adjust Mobile Tabs Position since header is smaller */
    .mobile-tabs-nav {
        top: 45px !important;
        /* Adjusted from 70px */
        padding: 0 !important;
        height: 40px;
        /* Fixed height for tabs */
    }

    .tab-item {
        padding: 8px 5px !important;
        font-size: 12px !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }

    /* Adjust container padding to account for fixed header + tabs */
    .main-layout {
        padding-top: 10px;
    }
}

/* Profile Cover */
.profile-cover {
    height: 250px;
    background-size: cover;
    background-position: center;
    border-radius: 0 0 8px 8px;
    position: relative;
    background-color: #e0e0e0;
}

.profile-header {
    position: relative;
    margin-bottom: 60px;
}

.profile-avatar {
    position: absolute;
    bottom: -50px;
    left: 20px;
    border: 4px solid white;
    border-radius: 50%;
    z-index: 2;
}

.profile-info {
    padding-top: 10px;
}