* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    line-height: 1.6;
}

/* רקע אפור כהה לעמוד הראשי */
.main-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #2d2d2d;
    min-height: 100vh;
    width: 100%;
}

/* כותרת ראשית */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #363636;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header h1 {
    color: #1877f2;
    font-size: 2.5em;
    margin-bottom: 20px;
}

/* סינון תגיות */
.tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.tag-filter {
    padding: 8px 16px;
    background: #404040;
    border-radius: 20px;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.tag-filter:hover,
.tag-filter.active {
    background: #1877f2;
    color: white;
}

/* פיד פוסטים */
.posts-feed {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* פוסט בודד */
.post {
    background: #363636;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.post-title {
    color: #ffffff;
    font-size: 1.8em;
    margin-bottom: 20px;
    border-bottom: 2px solid #404040;
    padding-bottom: 10px;
}

/* מדיה בפוסט */
.post-media {
    margin: 20px -25px;
    width: calc(100% + 50px);
    background: #2d2d2d;
}

.media-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #2d2d2d;
    padding: 10px 0;
}

.media-container img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    background-color: #2d2d2d;
    display: block;
}

.media-container video {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    background-color: #2d2d2d;
}

.media-container iframe {
    width: 100%;
    height: 450px;
    border: none;
    display: block;
}

.media-link {
    display: inline-block;
    padding: 12px 24px;
    background: #1877f2;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.media-link:hover {
    background: #166fe5;
}

/* תוכן הפוסט */
.post-content {
    font-size: 1.1em;
    color: #d0d0d0;
    margin: 20px 0;
    line-height: 1.8;
}

/* תחתית הפוסט */
.post-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #404040;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #b0b0b0;
    font-size: 0.9em;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.post-source a {
    color: #1877f2;
    text-decoration: none;
}

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

.post-time {
    color: #999;
}

/* תגיות בפוסט */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.post-tag {
    padding: 4px 12px;
    background: #404040;
    color: #1877f2;
    border-radius: 16px;
    text-decoration: none;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.post-tag:hover {
    background: #1877f2;
    color: white;
}

/* עיצוב לעמוד אדמין */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background-color: #2d2d2d;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #363636;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.admin-header h1 {
    color: #ffffff;
}

.logout-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: #c82333;
}

/* טופס הוספת פוסט */
.add-post-form,
.import-export,
.posts-list,
.freetext-section {
    background: #363636;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.add-post-form h2,
.import-export h2,
.posts-list h2,
.freetext-section h2 {
    color: #ffffff;
    margin-bottom: 20px;
    border-bottom: 2px solid #404040;
    padding-bottom: 10px;
}

.freetext-section {
    border-right: 4px solid #9c27b0;
}

.freetext-section h2::before {
    content: "✏️ ";
    margin-left: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #d0d0d0;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #404040;
    border-radius: 8px;
    font-size: 1em;
    background: #2d2d2d;
    color: #e0e0e0;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #1877f2;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: #1877f2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.3s ease;
}

.submit-btn:hover {
    background: #166fe5;
}

/* כפתורי ייבוא/ייצוא */
.import-export-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.export-btn,
.import-btn {
    padding: 12px 24px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s ease;
}

.export-btn:hover,
.import-btn:hover {
    background: #218838;
}

.import-export-buttons form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.import-export-buttons input[type="file"] {
    background: #2d2d2d;
    color: #e0e0e0;
    padding: 10px;
    border: 1px solid #404040;
    border-radius: 8px;
    max-width: 200px;
}

.import-note {
    color: #888;
    font-size: 0.85em;
    margin-top: 10px;
    font-style: italic;
}

/* תצוגת פוסטים באדמין */
.filter-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #2d2d2d;
    border-radius: 8px;
}

.filter-section form {
    display: flex;
    gap: 10px;
}

.filter-section select {
    flex: 1;
    padding: 10px;
    border: 1px solid #404040;
    border-radius: 8px;
    background: #363636;
    color: #e0e0e0;
}

.filter-section button {
    padding: 10px 20px;
    background: #1877f2;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.filter-section button:hover {
    background: #166fe5;
}

.post-item {
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #2d2d2d;
}

.post-item h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.post-item .media-preview {
    margin: 15px 0;
    max-width: 300px;
}

.post-item .media-preview img,
.post-item .media-preview video {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    background: #363636;
}

.post-meta {
    margin: 15px 0;
    color: #b0b0b0;
    font-size: 0.95em;
}

.tags {
    margin: 10px 0;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: #404040;
    color: #1877f2;
    border-radius: 16px;
    text-decoration: none;
    margin-left: 5px;
    margin-bottom: 5px;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.tag:hover {
    background: #1877f2;
    color: white;
}

.post-times {
    display: flex;
    gap: 15px;
    color: #888;
    font-size: 0.85em;
    margin-top: 10px;
    flex-wrap: wrap;
}

.delete-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 15px;
    font-size: 0.95em;
    transition: background 0.3s ease;
}

.delete-btn:hover {
    background: #c82333;
}

/* כפתורי עריכה וביטול */
.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.cancel-btn {
    flex: 1;
    padding: 14px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.1em;
    text-align: center;
    transition: background 0.3s ease;
}

.cancel-btn:hover {
    background: #5a6268;
}

.post-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    border-top: 1px solid #404040;
    padding-top: 15px;
}

.edit-btn {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95em;
    transition: background 0.3s ease;
    display: inline-block;
}

.edit-btn:hover {
    background: #218838;
}

/* התחברות */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: #363636;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.login-container h1 {
    color: #ffffff;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2em;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-container input {
    padding: 14px;
    border: 1px solid #404040;
    border-radius: 8px;
    font-size: 1em;
    background: #2d2d2d;
    color: #e0e0e0;
    transition: border-color 0.3s ease;
}

.login-container input:focus {
    outline: none;
    border-color: #1877f2;
}

.login-container button {
    padding: 14px;
    background: #1877f2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.3s ease;
}

.login-container button:hover {
    background: #166fe5;
}

/* הודעות */
.error-message,
.success-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
}

.error-message {
    background: #442326;
    color: #f8d7da;
    border: 1px solid #dc3545;
}

.success-message {
    background: #1e3a2a;
    color: #d4edda;
    border: 1px solid #28a745;
}

/* אין פוסטים */
.no-posts {
    text-align: center;
    padding: 50px;
    background: #363636;
    border-radius: 12px;
    color: #b0b0b0;
    font-size: 1.2em;
}

/* מלל חופשי בעמוד הראשי */
.freetext-display {
    background: #363636;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border-right: 4px solid #9c27b0;
    color: #e0e0e0;
    font-size: 1.1em;
    line-height: 1.8;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* חץ חזרה למעלה - גרסה מתוקנת ל-RTL */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 55px;
    height: 55px;
    background: #1877f2;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: 9999;
    border: none;
    outline: none;
    text-decoration: none;
    line-height: 1;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.back-to-top:hover {
    background: #166fe5;
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.back-to-top:active {
    transform: scale(0.95);
}

/* התאמה למובייל */
@media (max-width: 768px) {
    .main-container,
    .admin-container {
        padding: 10px;
    }
    
    .post {
        padding: 15px;
    }
    
    .post-media {
        margin: 15px -15px;
        width: calc(100% + 30px);
    }
    
    .post-title {
        font-size: 1.5em;
    }
    
    .media-container iframe {
        height: 250px;
    }
    
    .import-export-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .import-export-buttons form {
        flex-direction: column;
    }
    
    .import-export-buttons input[type="file"] {
        max-width: 100%;
    }
    
    .filter-section form {
        flex-direction: column;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .post-item .media-preview {
        max-width: 100%;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .media-container iframe {
        height: 200px;
    }
    
    .tags-filter {
        gap: 5px;
    }
    
    .tag-filter {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .back-to-top {
        bottom: 15px;
        right: 15px;
        width: 42px;
        height: 42px;
        font-size: 20px;
    }
}

/* למסכים גדולים מאוד */
@media (min-width: 1400px) {
    .back-to-top {
        bottom: 40px;
        right: 40px;
        width: 65px;
        height: 65px;
        font-size: 32px;
    }
}