/* Variables Globales y Theme System */
:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #050505;
    --text-secondary: #65676b;
    --primary-color: #0866ff;
    --primary-hover: #1877f2;
    --danger-color: #fa3e3e;
    --border-color: #ced0d4;
    --input-bg: #f0f2f5;
    --nav-bg: #ffffff;
    --shadow-fb: 0 1px 2px rgba(0, 0, 0, 0.2);
    --modal-bg: rgba(244, 244, 244, 0.8);
}

[data-theme="dark"] {
    --bg-color: #18191a;
    --card-bg: #242526;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --primary-color: #2d88ff;
    --primary-hover: #1877f2;
    --danger-color: #e41e3f;
    --border-color: #3e4042;
    --input-bg: #3a3b3c;
    --nav-bg: #242526;
    --shadow-fb: 0 1px 2px rgba(0, 0, 0, 0.5);
    --modal-bg: rgba(0, 0, 0, 0.7);
}

/* Reset Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}
body { background-color: var(--bg-color); color: var(--text-primary); line-height: 1.5; }
a { color: var(--primary-color); text-decoration: none; }
.card-shadow { box-shadow: var(--shadow-fb); background-color: var(--card-bg); border-radius: 8px; margin-bottom: 16px; }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.border-y { border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }

/* Helpers Color */
.fill-green { color: #45bd62; }
.fill-yellow { color: #f7b928; }

/* Navbar */
.navbar { background-color: var(--nav-bg); box-shadow: var(--shadow-fb); position: sticky; top: 0; z-index: 100; }
.nav-container { max-width: 680px; margin: 0 auto; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; }
/* Nav Logo image */
.nav-logo { display:flex; align-items:center; }
.nav-logo img { height: 60px; width: auto; object-fit: contain; }

/* Avatars */
.avatar-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder { width: 40px; height: 40px; border-radius: 50%; background: var(--input-bg); color: var(--text-secondary); display:flex; align-items:center; justify-content:center; font-size: 1.2rem; }
.nav-avatar { width: 36px; height: 36px; cursor: pointer; }

/* Forms */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.95rem; }
.input-lg { 
    width: 100%; 
    padding: 12px 15px; 
    border-radius: 8px; 
    border: 1px solid var(--border-color); 
    background: var(--input-bg); 
    color: var(--text-primary); 
    font-size: 1rem; 
    outline: none; 
    transition: all 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}
.input-lg:focus { 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 3px rgba(8, 102, 255, 0.2); 
    background: var(--card-bg);
}
.custom-file-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--input-bg);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    justify-content: center;
    font-weight: 600;
    color: var(--text-secondary);
}
.custom-file-upload:hover {
    background: var(--card-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.custom-file-upload input[type="file"] {
    display: none;
}

/* Buttons */
.btn { padding: 8px 16px; border-radius: 6px; font-weight: 600; cursor: pointer; border: none; font-size: 0.95rem; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-block { width: 100%; display:block; padding:10px; }
.btn-icon { background: none; border: none; font-size: 1.5rem; color: var(--text-primary); cursor: pointer; border-radius: 50%; width: 36px; height: 36px; display:inline-flex; justify-content:center; align-items:center; text-decoration: none; }
.btn-icon:hover { background-color: var(--input-bg); }

/* Layout Feed */
.main-content { max-width: 680px; margin: 20px auto; padding: 0; min-height: 80vh; }

/* Facebook Publisher Bar */
.publisher-bar { padding: 12px 16px; }
.publisher-top { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; }
.publisher-trigger { flex-grow: 1; background: var(--input-bg); color: var(--text-secondary); border: none; border-radius: 20px; padding: 10px 15px; text-align: left; font-size: 1rem; cursor: pointer; transition: background 0.2s; }
.publisher-trigger:hover { background: var(--border-color); }
.publisher-bottom { display: flex; padding-top: 8px; justify-content: space-around; }
.publisher-action { background: transparent; border: none; color: var(--text-secondary); font-weight: 600; cursor: pointer; padding: 8px; border-radius: 5px; display:flex; align-items:center; gap:8px; font-size:0.95rem; flex-grow: 1; justify-content: center; }
.publisher-action:hover { background: var(--input-bg); }
.publisher-action i { font-size: 1.4rem; }

/* Facebook Modal */
.fb-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--modal-bg); z-index: 1000; display: none; justify-content: center; align-items: center; }
.fb-modal-overlay.active { display: flex; }
.fb-modal { background: var(--card-bg); width: 100%; max-width: 500px; border-radius: 8px; box-shadow: 0 12px 28px rgba(0,0,0,0.2); display: flex; flex-direction: column; overflow: hidden; animation: pop 0.2s ease-out; }
@keyframes pop { from {transform: scale(0.95); opacity:0;} to {transform: scale(1); opacity:1;} }
.fb-modal-header { display: flex; align-items: center; justify-content: center; padding: 15px; position: relative; }
.fb-modal-header h3 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.close-modal-btn { position: absolute; right: 15px; top: 10px; background: var(--input-bg); border: none; border-radius: 50%; width: 36px; height: 36px; cursor: pointer; color: var(--text-secondary); font-size: 1.2rem; display:flex; justify-content:center; align-items:center; }
.close-modal-btn:hover { filter: brightness(0.9); }
.fb-modal form { padding: 16px; }
.fb-modal-user { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.author-name { font-weight: 600; font-size: 0.95rem; }
.privacy-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--input-bg); padding: 3px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; margin-top:2px; color: var(--text-secondary);}
.category-select { width: 100%; padding: 8px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--input-bg); color: var(--text-primary); margin-bottom: 10px; font-weight: 600;}
.fb-textarea { width: 100%; min-height: 120px; border: none; background: transparent; color: var(--text-primary); font-size: 1.2rem; resize: none; margin-bottom: 15px; outline: none; }
.fb-modal-addons { border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.fb-modal-addons span { font-weight: 600; font-size: 0.95rem; }
.addon-icons i { font-size: 1.6rem; cursor: pointer; margin-left: 10px; }
.publish-btn { font-size: 1rem; border-radius: 6px; }

/* Posts Feed FB Style */
.post-header-fb { display: flex; align-items: center; padding: 12px 16px; gap: 10px; }
.post-category { color: var(--text-secondary); font-weight: 400; }
.post-time { font-size: 0.8rem; color: var(--text-secondary); display:flex; align-items:center; gap:4px;}
.post-body-fb { padding: 0; }
.post-text { padding: 0 16px 10px 16px; font-size: 1rem; }
.post-image img { width: 100%; max-height: 600px; object-fit: cover; display: block; }
.image-link-wrapper { display: block; }
.post-actions { display: flex; padding: 4px 16px; margin-top: 5px; }
.action-btn { flex: 1; display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--text-secondary); font-weight: 600; padding: 6px 0; border-radius: 4px; cursor: pointer; border: none; background: transparent; font-size: 0.95rem; text-decoration:none; }
.action-btn:hover { background: var(--input-bg); }
.btn-like.liked i { color: var(--primary-color); }
.btn-like.liked { color: var(--primary-color); }

/* --- Hero Post Redesign --- */
.hero-post-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    background: var(--card-bg);
    min-height: 100vh;
    padding-bottom: 70px; /* Espacio para el dock inferior */
}

/* Botón Regresar - Secondary Sticky Nav */
.top-nav-back {
    position: sticky;
    top: 60px; /* Debajo de la navbar principal */
    z-index: 99;
    background: var(--nav-bg);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.top-nav-back a.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.top-nav-back a.back-btn i {
    font-size: 1.4rem;
}

/* Hero Header Image & Glass Panel */
.hero-header {
    position: relative;
    width: 100%;
    background-color: #000;
    overflow: hidden;
}

.hero-header .hero-image {
    width: 100%;
    max-height: 65vh;
    height: 400px;
    object-fit: cover;
    display: block;
    opacity: 0.9;
    cursor: pointer;
}

.glass-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 25px 20px 20px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ffffff;
}

.glass-title {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.glass-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.glass-meta .avatar-img {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(255,255,255,0.7);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.glass-meta-info {
    display: flex;
    flex-direction: column;
}

.glass-author {
    font-weight: 600;
    font-size: 1rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.glass-time {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Título sin imagen (Fallback) */
.hero-header.no-image {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
}
.hero-header.no-image .glass-panel {
    position: relative;
    background: transparent;
    color: var(--text-primary);
    backdrop-filter: none;
}
.hero-header.no-image .glass-title {
    text-shadow: none;
}
.hero-header.no-image .glass-author {
    text-shadow: none;
}
.hero-header.no-image .glass-meta .avatar-img {
    border-color: var(--border-color);
    box-shadow: none;
}

/* Post Content Area */
.hero-post-body {
    padding: 25px 20px;
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.hero-post-body p {
    margin-bottom: 1.5em;
}

/* Bottom Action Dock (Sticky) */
.dock-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 12px 0;
    z-index: 100;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.06);
}

@media (min-width: 681px) {
    .dock-actions {
        left: 50%;
        transform: translateX(-50%);
        width: 680px;
        border-radius: 16px 16px 0 0;
        border-left: 1px solid var(--border-color);
        border-right: 1px solid var(--border-color);
    }
}

.dock-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}

.dock-btn i {
    font-size: 1.6rem;
}

.dock-btn.liked {
    color: var(--primary-color);
}
.dock-btn.liked i {
    color: var(--primary-color);
}
.dock-btn:hover {
    color: var(--text-primary);
}

/* Footer */
.blog-footer {
    text-align: center;
    padding: 20px 20px 15px 20px;
    margin-top: 40px;
    background: var(--nav-bg);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.95rem;
}
.footer-container {
    max-width: 680px;
    margin: 0 auto;
}
.footer-links {
    margin-top: 10px;
}

/* General utility */
.fade-in { animation: fadeIn 0.4s ease-in; }
@keyframes fadeIn { from{opacity:0; transform: translateY(-10px);} to{opacity:1; transform: translateY(0);} }

/* Fullscreen Image Modal (Lightbox) */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.lightbox-modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-in;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    background: transparent;
    border: none;
    z-index: 1001;
}
.lightbox-content {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
}

/* Feed: Infinite Scroll & Read More */
.fade-out-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--card-bg));
    pointer-events: none;
}
.read-more-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0;
    margin-top: 5px;
    cursor: pointer;
    font-family: inherit;
}
.read-more-btn:hover {
    text-decoration: underline;
}
.infinite-spinner {
    padding: 20px;
}

/* Related Posts */
.related-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}
.related-card {
    flex: 1 1 calc(33.333% - 15px);
    min-width: 250px;
    height: 100px;
    background: var(--input-bg);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}
.related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    background: var(--bg-color);
}
.related-img {
    width: 100px;
    flex-shrink: 0;
    overflow: hidden;
}
.related-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.related-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.related-category {
    font-size: 0.70rem;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 3px;
}
.related-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 5px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.related-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .related-card {
        flex: 1 1 100%;
    }
}
