/* Havit (הבית) - Old Reddit Aesthetic with Mobile Support */

/* Reset and Base */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f7f8;
    --bg-tertiary: #dae0e6;
    --text-primary: #1c1c1c;
    --text-secondary: #7c7c7c;
    --text-tertiary: #0079d3;
    --border-color: #ccc;
    --link-color: #0079d3;
    --link-hover: #0079d3;
    --upvote-color: #ff4500;
    --difficulty-beginner: #4ade80;
    --difficulty-intermediate: #fbbf24;
    --difficulty-advanced: #f87171;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-hebrew: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    margin: 0;
    padding: 0;
    word-wrap: break-word;
}

/* Hebrew text direction */
[dir="rtl"] {
    direction: rtl;
}

.hebrew {
    font-family: var(--font-hebrew);
}

/* Hidden states */
.phonetic.hidden,
.english.hidden {
    display: none;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.site-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.site-title a {
    text-decoration: none;
    color: var(--text-primary);
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    gap: 4px;
}

.mode-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    font-family: var(--font-hebrew);
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: var(--bg-tertiary);
}

.mode-btn.active {
    background: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

.nikud-toggle {
    font-family: serif;
}

/* Main Layout */
.main {
    display: flex;
    flex: 1;
    padding: 20px;
    gap: 20px;
}

.content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 312px;
    flex-shrink: 0;
}

/* Posts List */
.posts-list {
    max-width: 100%;
}

.post {
    display: flex;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    margin-bottom: -1px;
    padding: 8px;
}

.posts-list > .post:first-child {
    border-radius: 4px 4px 0 0;
}

.posts-list > .post:last-child {
    border-radius: 0 0 4px 4px;
    border-bottom: 1px solid var(--border-color);
}

.post-votes {
    width: 40px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8px;
}

.vote-count {
    font-size: 12px;
    font-weight: bold;
    color: var(--upvote-color);
}

.vote-count + .vote-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: normal;
}

.post-votes.large .vote-count {
    font-size: 24px;
}

.post-votes.large .vote-label {
    font-size: 14px;
}

.post-content {
    flex: 1;
    min-width: 0;
}

.post-title {
    font-size: 18px;
    font-weight: normal;
    margin: 0 0 4px 0;
}

.post-title a {
    text-decoration: none;
    color: var(--link-color);
}

.post-title a:hover {
    text-decoration: underline;
}

.post-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.meta-divider {
    margin: 0 4px;
}

.username {
    color: var(--text-secondary);
    text-decoration: none;
}

.time {
    color: var(--text-secondary);
}

.comment-count {
    color: var(--text-secondary);
}

.subreddit-link {
    color: var(--text-tertiary);
    text-decoration: none;
    font-weight: bold;
}

.subreddit-link:hover {
    text-decoration: underline;
}

.post-body {
    margin-top: 8px;
    line-height: 1.6;
}

/* Difficulty Badge */
.difficulty-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
}

.difficulty-beginner {
    background: var(--difficulty-beginner);
}

.difficulty-intermediate {
    background: var(--difficulty-intermediate);
}

.difficulty-advanced {
    background: var(--difficulty-advanced);
}

/* Post Detail */
.post-detail {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.post-detail-header {
    margin-bottom: 16px;
}

.post-detail-title {
    font-size: 20px;
    font-weight: normal;
    margin: 0 0 8px 0;
}

.post-detail-title a {
    text-decoration: none;
    color: var(--link-color);
}

.post-detail-body {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 4px;
    line-height: 1.7;
}

.post-detail-actions {
    display: flex;
    align-items: center;
    padding-top: 16px;
}

/* Sidebar */
.sidebar-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 16px;
}

.sidebar-section h3 {
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 12px 0;
    color: var(--text-secondary);
    text-transform: uppercase;
}

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

.subreddit-list li {
    margin-bottom: 8px;
}

.subreddit-list a {
    color: var(--text-tertiary);
    text-decoration: none;
    font-weight: bold;
    display: block;
}

.subreddit-list a:hover {
    text-decoration: underline;
}

.sub-desc {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.sub-description {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.sub-meta {
    font-size: 12px;
}

/* Subreddit Header */
.subreddit-header {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.subreddit-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 8px 0;
}

.subreddit-description {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Comments */
.comments-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
}

.comments-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 16px 0;
}

.comment {
    padding: 12px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.comment:last-child {
    border-bottom: none;
}

.comment[data-depth="1"] {
    padding-right: 24px;
}

.comment[data-depth="2"] {
    padding-right: 48px;
}

.comment-header {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.comment-body {
    font-size: 14px;
    line-height: 1.5;
}

/* Empty States */
.empty-state,
.empty-comments {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: none;
}

.pagination a {
    color: var(--link-color);
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 4px;
}

.pagination a:hover {
    background: var(--bg-secondary);
    text-decoration: underline;
}

.page-info {
    color: var(--text-secondary);
}

/* Back Link */
.back-link {
    padding: 16px;
}

.back-link a {
    color: var(--link-color);
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Word Translation (Interactive) */
.word {
    cursor: pointer;
    padding: 2px 0;
    border-bottom: 1px dotted transparent;
    transition: border-color 0.2s;
}

.word:hover {
    border-bottom-color: var(--link-color);
}

.word.active {
    background: var(--bg-secondary);
    border-radius: 2px;
    padding: 2px 4px;
}

/* English text styling */
.english {
    font-family: var(--font-main);
    direction: ltr;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }

    .sidebar {
        width: 100%;
        order: -1;
    }

    .header {
        padding: 8px 10px;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 10px;
    }

    .site-title {
        font-size: 20px;
    }

    .post {
        padding: 6px;
    }

    .post-votes {
        width: 32px;
    }

    .post-title {
        font-size: 16px;
    }

    .post-detail-title {
        font-size: 18px;
    }

    .subreddit-title {
        font-size: 20px;
    }

    .comment[data-depth="1"],
    .comment[data-depth="2"] {
        padding-right: 12px;
    }

    .mode-switcher {
        gap: 2px;
    }

    .mode-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .post-title {
        font-size: 15px;
    }

    .post-meta {
        flex-wrap: wrap;
    }

    .post-detail-header,
    .post-detail-body {
        padding: 12px;
    }
}

/* Utility */
.hidden {
    display: none !important;
}
