/* Social Feed & Components */

/* ==========================================================================
   Feed Layout (extracted from feed.html inline styles)
   ========================================================================== */

.feed-container {
    max-width: 650px;
    margin: 0 auto;
    padding: 16px 12px;
    padding-bottom: 100px;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.feed-header h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--md-sys-color-on-surface);
    margin: 0;
    font-size: clamp(1.5rem, 5vw, 2rem);
}

.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    margin-bottom: 16px;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

md-filled-text-field {
    --md-filled-text-field-container-shape: 16px;
    --md-filled-text-field-container-color: rgba(255, 255, 255, 0.05);
    --md-filled-text-field-active-indicator-height: 0;
    --md-filled-text-field-focus-active-indicator-height: 0;
    /* Compatibility aliases */
    --md-filled-field-container-shape: 16px;
    --md-filled-field-container-color: rgba(255, 255, 255, 0.05);
    --md-filled-field-active-indicator-height: 0;
    --md-filled-field-focus-active-indicator-height: 0;
}

html[data-mdc-theme="light"] md-filled-text-field {
    --md-filled-text-field-container-color: rgba(0, 0, 0, 0.03);
    --md-filled-field-container-color: rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   Comment Section Container
   ========================================================================== */

.comments-container {
    background-color: var(--md-sys-color-surface-container-low, #F7F2FA);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual Comment Bubble */
.comment-bubble {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-content-box {
    background-color: var(--md-sys-color-surface-container-high, #ECE6F0);
    padding: 8px 12px;
    border-radius: 0 16px 16px 16px; /* Top-left corner sharp for "speech bubble" effect */
    max-width: 90%;
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface, #1D1B20);
    margin: 0;
}

.comment-author-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

.comment-author-link:hover .comment-author-name {
    text-decoration: underline;
}

.comment-author-link:hover .comment-avatar {
    opacity: 0.8;
}

.comment-timestamp {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant, #49454F);
}

.comment-text {
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface, #1D1B20);
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Comment Input Form */
.comment-form-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    background-color: var(--md-sys-color-surface, #FEF7FF);
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    border: 1px solid var(--md-sys-color-outline-variant, #CAC4D0);
    transition: border-color 0.2s;
}

.comment-form-container:focus-within {
    border-color: var(--md-sys-color-primary, #6750A4);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary, #6750A4);
}

.comment-input {
    flex-grow: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--md-sys-color-on-surface, #1D1B20);
    padding: 8px 0;
}

.comment-input::placeholder {
    color: var(--md-sys-color-on-surface-variant, #49454F);
}

.comment-submit-btn {
    background: var(--md-sys-color-primary, #6750A4);
    color: var(--md-sys-color-on-primary, #FFFFFF);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.comment-submit-btn:hover {
    background: var(--md-sys-color-primary-container, #EADDFF);
    color: var(--md-sys-color-on-primary-container, #21005D);
}

.comment-submit-btn:active {
    transform: scale(0.95);
}

.comment-submit-btn .material-symbols-outlined {
    font-size: 20px;
}

/* ==========================================================================
   Post Cards — mobile-first base values
   ========================================================================== */

.post-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0;
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: 8px;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 196, 198, 208), 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    animation: card-entry 0.6s ease-out;
}

html[data-mdc-theme="dark"] .post-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

@keyframes card-entry {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hover transform only for mouse/trackpad devices */
@media (hover: hover) and (pointer: fine) {
    .post-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    }
}

.post-header {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.post-header__menu {
    position: relative;
}

.post-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px; /* Squircle style */
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.post-user-link {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
}

.post-user-info {
    flex: 1;
}

.post-user-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 17px;
    color: var(--md-sys-color-on-surface);
    margin: 0;
}

.post-time {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
    margin: 0;
}

.post-content {
    padding: 0 16px 16px;
}

.post-text {
    margin: 0 0 16px 0;
    line-height: 1.6;
    font-size: 16px;
    color: var(--md-sys-color-on-surface);
}

.post-image {
    display: block;
    width: 100%;
    cursor: zoom-in;
    touch-action: pan-y;
}

.post-image--zooming {
    position: relative;
    z-index: 50;
    transform-origin: 0 0;
    will-change: transform;
    -webkit-touch-callout: none;
}

.post-card--zooming {
    position: relative;
    z-index: 10;
    overflow: visible;
}

@media (hover: none) {
    .post-image {
        cursor: default;
    }
}

.post-actions {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    align-items: center;
    padding: 10px 16px 16px;
    border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 196, 198, 208), 0.1);
    margin-top: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 12px;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 14px;
    min-height: 44px;
}

.action-btn:hover {
    background: rgba(var(--md-sys-color-primary-rgb, 0, 99, 155), 0.08);
    color: var(--md-sys-color-primary);
}

.action-btn.liked {
    color: #ff4081;
}

.action-btn.liked .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

/* Like container and buttons (extracted from post_card.html inline styles) */
.post-actions__like-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-actions__likes-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.post-actions__like-count {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Override old comment styles with the glassmorphism ones */
.comments-section {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 16px 0; /* Padding collapse to avoid empty space */
    border-top: 1px solid transparent;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 0.3s ease-out, padding 0.3s ease-out, border-color 0.3s ease-out;
}

.comments-section.show {
    max-height: 2000px; /* Arbitrary large max-height */
    opacity: 1;
    padding: 16px 16px 24px;
    border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 196, 198, 208), 0.1);
    transition: max-height 0.6s ease-in-out, opacity 0.5s ease-in, padding 0.4s ease-in, border-color 0.4s ease;
}

.comment-bubble {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    animation: card-entry 0.4s ease-out;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    object-fit: cover;
}

.comment-content-box {
    flex: 1;
    background: rgba(var(--md-sys-color-surface-variant-rgb, 224, 226, 236), 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 14px 18px;
    border-radius: 20px;
    color: var(--md-sys-color-on-surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

html[data-mdc-theme="light"] .comment-content-box {
    background: rgba(0, 0, 0, 0.03);
}

.comment-author-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--md-sys-color-primary);
    margin: 0 0 4px 0;
}

.comment-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

/* Verified badge — inline con nombre de usuario en todos los contextos */
.verified-badge {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    color: var(--md-sys-color-primary);
    line-height: 1;
}

.verified-badge .material-symbols-outlined {
    font-size: 18px;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 18;
}

/* === Comment edit/delete actions === */
.comment-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.comment-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--md-sys-color-outline);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease;
}

.comment-action-btn .material-symbols-outlined {
    font-size: 16px;
}

.comment-action-btn:hover {
    background: var(--md-sys-color-surface-variant);
}

.comment-action-delete:hover {
    color: var(--md-sys-color-error);
}

.comment-edit-form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* ==========================================================================
   Feed empty / loader / end states (extracted from feed_posts.html)
   ========================================================================== */

.feed-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--md-sys-color-on-surface-variant);
}

.feed-empty__icon {
    font-size: 64px;
    color: var(--md-sys-color-outline);
    margin-bottom: 16px;
    display: block;
}

.feed-empty__title {
    margin: 0 0 8px;
    color: var(--md-sys-color-on-surface);
    font-size: 1.2rem;
    font-weight: 500;
}

.feed-empty__text {
    margin: 0 auto 24px;
    font-size: 0.95rem;
    max-width: 350px;
    line-height: 1.5;
}

.feed-loader {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface-variant);
}

.feed-loader__spinner {
    animation: spin 1.2s linear infinite;
    font-size: 28px;
    margin: 0;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.feed-end {
    text-align: center;
    padding: 32px 16px;
    color: var(--md-sys-color-on-surface-variant);
}

.feed-end__icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.4;
}

.feed-end__text {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.6;
}

/* ==========================================================================
   Responsive — Tablet (>=600px)
   ========================================================================== */

@media (min-width: 600px) {
    .feed-container { padding: 24px 16px; padding-bottom: 120px; }
    .feed-header { margin-bottom: 24px; }
    .filter-chips { gap: 12px; margin-bottom: 24px; }
    .post-card { border-radius: 28px; margin-left: 0; margin-right: 0; margin-bottom: 24px; box-shadow: 0 15px 35px rgba(0,0,0,0.05); border: 1px solid rgba(255, 255, 255, 0.5); }
    .post-header { padding: 20px 24px; gap: 16px; }
    .post-content { padding: 0 24px 24px; }
    .post-actions { gap: 20px; padding: 12px 24px 20px; margin-top: 8px; }
    .comments-section.show { padding: 16px 24px 24px; }
}

/* ==========================================================================
   Responsive — Desktop (>=900px)
   ========================================================================== */

@media (min-width: 900px) {
    .post-card { border-radius: 32px; margin-bottom: 32px; }
}

/* ==========================================================================
   Responsive — Short phones
   ========================================================================== */

@media (max-height: 700px) and (max-width: 900px) {
    .feed-container { padding-top: 8px; }
    .feed-header { margin-bottom: 8px; }
    .filter-chips { margin-bottom: 8px; padding: 4px 0; }
    .post-card { margin-bottom: 12px; }
    .post-header { padding: 12px 16px; }
    .post-content { padding: 0 16px 12px; }
    .post-actions { padding: 8px 16px 12px; }
}

/* ==========================================================================
   Share Dialog
   ========================================================================== */

.share-dialog__headline {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 20px;
    text-align: center;
}

.share-dialog__content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.share-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
    min-height: 44px;
}

.share-option-btn:hover { opacity: 0.85; }

.share-option-whatsapp {
    background: #25D366; /* WhatsApp brand color */
    color: #fff;
}

.share-option-copy {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}
