@font-face {
    font-family: 'PortadaARA';
    src: url('fonts/PortadaARA-Bold.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'iBrand';
    src: url('fonts/ibrand.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --accent-color: #CEA24B;
    --input-bg: #f0f0f0;
    --input-border: #e0e0e0;
    --btn-dark: #3a3b40;
}

[data-theme="dark"] {
    --bg-color: #1a1a1c;
    --text-color: #ffffff;
    --input-bg: #242529;
    --input-border: #333;
    --btn-dark: #2a2b30;
}

html { scroll-behavior: smooth; }

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'PortadaARA', Tahoma, Arial, sans-serif; 
    -webkit-tap-highlight-color: transparent; 
}

body { 
    background-color: var(--bg-color); 
    color: var(--text-color); 
    display: flex; 
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    transition: background-color 0.3s;
}

.app-container {
    width: 100%;
    max-width: 450px;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

#announcement-banner {
    background-color: var(--accent-color);
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 100;
    animation: slideDown 0.5s ease-out;
}
@keyframes slideDown { from { top: -50px; } to { top: 0; } }

#posts-wrapper {
    flex: 1;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 100px;
}
#posts-wrapper::-webkit-scrollbar { display: none; }
#posts-wrapper { -ms-overflow-style: none; scrollbar-width: none; }

.post-container {
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

.post-text {
    color: var(--accent-color);
    font-size: 26px;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-wrap;
    padding: 0 15px;
}

.post-category-box {
    background-color: var(--btn-dark);
    color: var(--text-color);
    font-size: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
}
.cat-icon-mini svg {
    width: 16px;
    height: 16px;
    fill: var(--text-color);
}

.post-author {
    color: var(--accent-color);
    font-family: 'iBrand', sans-serif;
    font-size: 18px;
    margin-bottom: 40px;
}

.action-icons { display: flex; gap: 30px; align-items: center; }
.icon-btn { 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 10px; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    height: 50px;
    justify-content: flex-start;
}
.icon-btn svg { width: 28px; height: 28px; fill: var(--accent-color); }
.like-count { 
    color: var(--accent-color); 
    font-size: 14px; 
    font-weight: bold; 
    position: absolute;
    top: 40px;
}

.top-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    margin-top: 30px;
}
.brand-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: var(--accent-color);
    font-size: 18px;
}
.filter-alert {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--btn-dark);
    color: var(--accent-color);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 10;
}

.back-btn { background: none; border: none; color: var(--text-color); cursor: pointer; }
.back-btn svg { width: 24px; height: 24px; fill: currentColor; }
.theme-toggle svg { width: 24px; height: 24px; fill: var(--text-color); }

.bottom-nav {
    position: fixed;
    bottom: 30px;
    width: 100%;
    max-width: 450px;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 20;
}
.nav-btn {
    pointer-events: auto;
    width: 55px;
    height: 55px;
    background-color: var(--btn-dark);
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.nav-btn svg { width: 24px; height: 24px; fill: var(--accent-color); }

.form-container { padding: 20px; margin-top: 80px; height: 100%; overflow-y: auto; }
.input-group { background-color: var(--input-bg); border-radius: 16px; overflow: hidden; margin-bottom: 20px; }
.input-group input { width: 100%; padding: 18px 20px; border: none; background: transparent; color: var(--text-color); text-align: right; font-size: 16px; }
.input-group input:first-child { border-bottom: 1px solid var(--input-border); }
.input-group input:focus { outline: none; }

.btn-row { display: flex; gap: 10px; }
.submit-btn { flex: 1; padding: 15px; background-color: var(--accent-color); color: #fff; border: none; border-radius: 12px; font-size: 16px; cursor: pointer; }
.submit-btn.outline { background-color: transparent; border: 1px solid var(--accent-color); color: var(--accent-color); }

.color-selector { display: flex; justify-content: center; gap: 15px; margin-bottom: 30px; }
.color-circle { width: 35px; height: 35px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.color-circle:hover { transform: scale(1.1); }
.color-circle.active { border-color: var(--text-color); }

/* ساختار دسته‌بندی‌ها به شکل گرید */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 10px 0;
    direction: rtl;
}
.category-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}
.category-grid-item:hover .cat-icon-wrapper {
    background-color: var(--accent-color);
}
.category-grid-item:hover .cat-icon-wrapper svg {
    fill: #fff;
}
.category-selectable {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.cat-checkbox { display: none; }
.cat-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
    font-size: 13px;
    cursor: pointer;
    transition: 0.3s;
}
.cat-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--input-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s;
}
.cat-icon-wrapper svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
    transition: 0.3s;
}
.cat-checkbox:checked + .cat-label .cat-icon-wrapper {
    background-color: var(--accent-color);
}
.cat-checkbox:checked + .cat-label .cat-icon-wrapper svg {
    fill: #fff;
}
.cat-checkbox:checked + .cat-label span {
    color: var(--accent-color);
}

.profile-avatar { width: 120px; height: 120px; background-color: var(--accent-color); border-radius: 50%; margin: 0 auto 15px auto; display: flex; justify-content: center; align-items: center; overflow: hidden; }
.profile-name { text-align: center; font-size: 20px; margin-bottom: 5px; }
.btn-logout { width: 100%; padding: 15px; background: transparent; border: 1px solid var(--accent-color); color: var(--text-color); border-radius: 25px; font-size: 16px; cursor: pointer; margin-bottom: 20px; }
.fav-title { text-align: center; color: var(--accent-color); padding-bottom: 10px; border-bottom: 2px solid var(--accent-color); width: fit-content; margin: 0 auto 20px auto; font-size: 14px; }

.fav-list { display: flex; flex-direction: column; gap: 15px; padding-bottom: 50px;}
.fav-item { background: var(--input-bg); padding: 15px; border-radius: 12px; border: 1px solid var(--input-border); }
.fav-item-text { color: var(--accent-color); font-size: 16px; margin-bottom: 10px; white-space: pre-wrap; line-height: 1.5; }

#toast { visibility: hidden; min-width: 200px; background-color: var(--btn-dark); color: #fff; text-align: center; border-radius: 30px; padding: 12px 20px; position: fixed; z-index: 999; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 14px; }
#toast.show { visibility: visible; animation: fadein 0.3s, fadeout 0.3s 2.2s; }
@keyframes fadein { from {opacity: 0;} to {opacity: 1;} }
@keyframes fadeout { from {opacity: 1;} to {opacity: 0;} }

.alert { color: #ff5252; text-align: center; margin-bottom: 15px; font-size: 14px; }
textarea.custom-textarea { width: 100%; height: 200px; background: var(--input-bg); border: none; border-radius: 16px; padding: 20px; color: var(--accent-color); font-size: 18px; resize: none; margin-bottom:20px; }
textarea.custom-textarea:focus { outline: none; }

.dialog-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; visibility: hidden; opacity: 0; transition: opacity 0.3s ease; }
.dialog-overlay.active { visibility: visible; opacity: 1; }
.dialog-content { width: 100%; max-width: 450px; background-color: var(--input-bg); border-top-left-radius: 24px; border-top-right-radius: 24px; padding: 30px 20px; text-align: center; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); border-top: 1px solid var(--accent-color); max-height: 80vh; overflow-y: auto;}
.dialog-overlay.active .dialog-content { transform: translateY(0); }
.dialog-message { color: var(--text-color); font-size: 18px; margin-bottom: 25px; line-height: 1.6; }

.share-option { padding: 15px; background: var(--btn-dark); border-radius: 12px; margin-bottom: 15px; color: var(--accent-color); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; }
