:root {
    --bg-color: #0b132b; 
    --card-bg: #1c2541; 
    --text-color: #ffffff;
    --text-muted: #94a3b8; 
    --accent: #e63946; 
}

body.light-mode {
    --bg-color: #f8f9fa; 
    --card-bg: #ffffff; 
    --text-color: #212529; 
    --text-muted: #6c757d;
}

* { 
    box-sizing: border-box; margin: 0; padding: 0; 
    font-family: var(--font-main); 
    -webkit-tap-highlight-color: transparent;
}

.no-select { user-select: none; -webkit-user-select: none; }

body {
    background-color: var(--bg-color); color: var(--text-color);ب
    transition: background-color 0.4s ease, color 0.4s ease;
    display: flex; flex-direction: column; min-height: 100vh;
}

/* --- هدر و فوتر --- */
header { text-align: center; padding: 40px 20px; background: rgba(0,0,0,0.15); position: relative; overflow: hidden; }
header.has-cover { padding: 40px 20px; color: #fff; }
.header-cover-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; opacity: 0.4; z-index: 0; }
.header-content { position: relative; z-index: 1; }
body.light-mode header { background: rgba(0,0,0,0.03); box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
header img { max-height: 90px; max-width: 100%; object-fit: contain; }

footer { text-align: center; padding: 40px 20px 20px; background: rgba(0,0,0,0.15); margin-top: auto; }
body.light-mode footer { background: rgba(0,0,0,0.03); border-top: 1px solid #e9ecef;}
footer p { margin-bottom: 0px; color: var(--text-muted); font-size: 12px; }
footer img { max-height: 60px; max-width: 100%; object-fit: contain; }

.sub-text {
    font-family: Material Symbols Rounded; border-top: 1px solid rgb(20 29 55);
    width: 80%; place-self: center; padding: 10px 0px; margin-top: 5px;
    color: #3266d1; filter: saturate(0.5); opacity: 0.7;
}  
.sub-text.small { font-family: Material Symbols Rounded; font-size: 8px; border-top: none; padding-top: 0; margin-top: 2px; }
body.light-mode .sub-text { border-top: 1px solid #dbdbdb; opacity: 0.8; color: gray; }

.liner {
    color: red; z-index: 99999; display: block;
    border-top: 3px solid #2b62cd; width: 25%; place-items: center; text-align: center; place-self: center;
}
body.light-mode .liner { border-top: 3px solid #d49d2c;}

/* --- ساختار اصلی --- */
main { flex: 1; max-width: 900px; margin: 40px auto; padding: 0 20px; width: 100%; }

/* --- کارت پست (ساختار چرخش درست) --- */
.post-card {
    background-color: var(--card-bg); 
    border-radius: 12px;
    margin-bottom: 30px; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    position: relative; 
    border-bottom: 5px solid var(--accent); 
    border-bottom-left-radius: 5px; 
    border-bottom-right-radius: 5px;
    
    /* تنظیمات چرخش */
    perspective: 1000px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    
    /* حداقل ارتفاع برای زیبایی */
    min-height: 680px; 
    display: flex;
    flex-direction: column;
}
body.light-mode .post-card { box-shadow: 0 4px 15px rgba(0,0,0,0.08); border-bottom*: 5px solid orange; }

/* وقتی کارت می‌چرخه */
.post-card.flipped { transform: rotateY(180deg); }

/* کادر داخلی که پشت و رو رو نگه می‌داره */
.flip-card-inner {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

/* روی کارت و پشت کارت */
.flip-card-front, .flip-card-back {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    z-index: 99;
}

.flip-card-front {
    background-color: var(--card-bg);
    overflow: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
    background: var(--card-bg);
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0px;
}

/* --- بقیه استایل‌های کارت --- */
.post-title {
    position: absolute; color: #fff;
    background: color-mix(in srgb, var(--accent) 85%, transparent);
    bottom: 0; left: 0; right: 0; width: 100%; margin: 0; padding: 10px 20px;
    font-size: 11px; backdrop-filter: blur(5px); z-index: 10; text-align: right; box-sizing: border-box;
}
body.light-mode .post-title* { color: rgba(0, 0, 0, 0.7); background: rgba(255, 255, 255, 0.6); }

.post-content {
    margin-top: 10px; 
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    opacity: 0.9;
    margin-bottom: 15px;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 8;
    overflow: hidden;

    min-height: 205px;
    max-height: calc(14px * 1.8 * 8);
}

.post-contents {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    opacity: 0.9;
    margin-bottom: 15px;
}

.post-image-container {
    margin: -30px -30px 0px -30px; width: calc(100% + 60px);
    overflow: hidden; position: relative; border-radius: 12px 12px 0 0; 
}
.post-image-container img {
    width*: 100%; min-width: 600px; max-height: 340px; display: block; object-fit: cover; filter: grayscale(0);place-self: center; display: flex;
}

.hidden-btn { position: absolute; bottom: 12px; left: 15px; color: transparent; text-decoration: none; font-size: 14px; cursor: default; }

.pinned-badge {
    display: inline-block; font-size: 20px; color: var(--accent); margin-bottom: 10px; font-weight: bold;
    float: left; filter: grayscale(1); position: absolute; left: 15px; top: 10px; z-index: 99; opacity: 0.7;
}

.comments-trigger {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 15px;
    font-family: Arial, sans-serif; margin-top: 15px;
}
body.light-mode .comments-trigger { border-top-color: rgba(0,0,0,0.1); }

.comments-trigger .num {
    font-family: 'Material Symbols Rounded'; font-size: 28px; font-family*: sans-serif; font-weight: bold; color: var(--accent); line-height: 1;
}
body.light-mode .comments-trigger .num { color*: orange; }

.theme-toggle {
    position: fixed; top: 20px; left: 20px; background: center; color: var(--text-color);
    border: none; padding: 12px 18px; border-radius: 0px; cursor: pointer;
    box-shadow*: 0 4px 15px rgba(0,0,0,0.2); font-size: 22px; z-index: 100;
    transition: transform 0.2s, background 0.3s;
}
.theme-toggle:hover { transform: scale(1.05); }

red { color: #e63946; } blue { color: #3a86ff; } green { color: #2a9d8f; }
yellow { color: #e9c46a; } orange { color: #ff6626; } purple { color: #8338ec; }
gray { color: #94a3b8; } dia { color: #9ac5db; }

body.light-mode header img, body.light-mode footer img { filter: invert(1); }

.comment-form input, .comment-form textarea {
    width: 100%; font-size: 14px; padding: 12px; margin-bottom: 10px; border-radius: 8px;
    border: 1px solid rgba(128,128,128,0.3); background: var(--card-bg);
    color: var(--text-color); font-family: var(--font-main); outline: none; text-align: justify;
}
.comment-form textarea { resize: vertical; min-height: 80px; }
.comment-form button {
    width: 100%; font-size: 15px; padding: 12px; background: var(--accent); color: white;
    border: none; border-radius: 8px; font-weight: bold; cursor: pointer; font-family: var(--font-main);
}
.alert-success {
    background: var(--accent);
    color: var(--text-color);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
    border: 1px solid var(--accent);
}
.comment-item {
    background: var(--card-bg); padding: 10px 15px; border-radius: 10px; margin-bottom: 10px; border-left: 3px solid var(--accent);
}
.comment-item .c-head {
    display: flex; justify-content: space-between; margin-bottom: 8px;
    font-size: 12.8px; color: var(--text-muted); border-bottom: 1px dashed rgba(128,128,128,0.2); padding-bottom: 8px;
}
.comment-item .c-name { font-weight: bold; font-size: 15px; color: var(--text-color); }
.comment-item .c-text { font-size: 12.8px; line-height: 1.6; text-align: justify; white-space: pre-wrap; }

.back-link { display: inline-block; font-size: 12px; margin-bottom: 20px; color: var(--accent); text-decoration: none; font-weight: bold; text-align: left; width: 100%; }
a { text-decoration: none; color: var(--accent); }

/* --- گرید دسکتاپ --- */
@media (min-width: 769px) {
    main#post-container { display: grid; gap: 25px; align-items: stretch; }
    main#post-container.grid-2 { grid-template-columns: 1fr 1fr; }
    main#post-container.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
    main#post-container.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

/* --- استایل‌های پشت پست --- */
.views-counter { font-family: 'Material Symbols Rounded'; font-size: 70px; font-weight: bold; color: var(--accent); }
.views-label { font-family: 'Material Symbols Rounded'; font-size: 14px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 20px; }
.socials-back { display: flex; gap: 15px; margin-bottom: 20px; }
.socials-back a { color: var(--text-color); font-size: 24px; }
.socials-back.grayscale a { filter: grayscale(1); }
.continue-btn { font-family*: 'Material Symbols Rounded'; background*: var(--accent); color: var(--accent); padding: 0px; text-align: left; text-decoration: none; font-weight*: bold; font-size: 12.8px; display: inline-block; }

/* --- دکمه شناور (نسخه جدید و مدرن) --- */
.fab-container {
    position: fixed;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.fab-main {
    width: 60px;
    height: 60px;
    background*: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    position: relative;
    z-index: 2;
}

.fab-main:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.fab-main.active {
    transform: rotate(135deg);
    background: var(--accent);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.fab-main span {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    pointer-events: none;
    padding-bottom: 10px;
}

.fab-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* افکت ظاهر شدن آبشاری آیتم‌ها */
.fab-menu.active .fab-item {
    animation: fabSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.fab-menu.active .fab-item:nth-child(1) { animation-delay: 0.05s; }
.fab-menu.active .fab-item:nth-child(2) { animation-delay: 0.1s; }
.fab-menu.active .fab-item:nth-child(3) { animation-delay: 0.15s; }
.fab-menu.active .fab-item:nth-child(4) { animation-delay: 0.2s; }

@keyframes fabSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fab-item {
    background*: rgba(28, 37, 65, 0.85); /* بک‌گراند نیمه شفاف */
/*    backdrop-filter: blur(10px); /* افکت شیشه‌ای */
/*    -webkit-backdrop-filter: blur(10px); */
    color: var(--text-color);
    padding:6px 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: 12.8px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.3s, transform 0.2s;
}

body.light-mode .fab-item {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.fab-item:hover {
    background: var(--card-bg);
    transform: scale(1.05);
}

/* ارتفاع مخصوص وقتی کامنت‌ها غیرفعال هستند */
.post-card.no-comments {
    min-height: 620px;
}

.socials-back {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}
.socials-back a {
    color: var(--text-color);
    font-size: 24px;
    transition: transform 0.2s;
}
.socials-back a:hover {
    transform: scale(1.2);
}

/* افکت شیشه‌ای برای منوهای دکمه شناور */
.fab-menu.glass-effect .fab-item {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    background: rgba(28, 37, 65, 0.6) !important; /* اگر رنگ پنل رو خواستی داشته باشی، این خط رو با rgba همون رنگ جایگزین کن */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* برای حالت روشن (لایت مود) */
body.light-mode .fab-menu.glass-effect .fab-item {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
}


/* در موبایل ارتفاع کمی بیشتر بشه */
@media (max-width: 768px) {
    .post-card.no-comments {
        min-height: 640px;
    }
    
    .post-content {
    margin-top: 0px;}
}

@media (max-width: 600px) {
    .post-card { min-height*: 350px; }
    .post-title { padding-right: 20px !important;}
    .flip-card-front, .flip-card-back { padding:0px; }
    .comment-form button {width: 100% !important;}
    .front-fix { padding: 20px; }
    .post-image-container { margin: -20px -20px 10px -20px; width: calc(100% + 40px); }
    .theme-toggle { top: 15px; left: 15px; padding: 10px 14px; font-size: 30px; }
}