@import url('https://fonts.googleapis.com/css2?family=Alef:wght@400;700&family=Assistant:wght@400;600;700&family=David+Libre:wght@400;700&family=Frank+Ruhl+Libre:wght@400;700&family=Heebo:wght@400;600;700&family=Rubik:wght@400;600;700&family=Secular+One&family=Tinos:wght@400;700&family=Varela+Round&display=swap');

:root {
    --primary: #2563eb;
    --secondary: #1e40af;
    --bg: #f8fafc;
    --text-main: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    direction: rtl; font-family: 'Heebo', system-ui, -apple-system, sans-serif;
    background-color: var(--bg); color: var(--text-main); line-height: 1.6;
}

a { text-decoration: none; color: var(--primary); transition: 0.2s; }
a:hover { color: var(--secondary); }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* תיקון רוחב כפתור אוטומטי בהתאם לטקסט */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #ffffff !important; padding: 8px 20px; 
    border-radius: var(--radius); border: none; cursor: pointer; font-weight: 600; text-align: center;
    font-family: inherit; transition: 0.2s; text-decoration: none !important; font-size: 0.9rem;
    width: fit-content; white-space: nowrap;
}
.btn:hover, .btn:focus, .btn:active { 
    background: var(--secondary); outline: 2px solid var(--primary); outline-offset: 2px; color: #ffffff !important; 
}
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-danger { background: #ef4444; color: #ffffff !important; }
.btn-danger:hover { background: #dc2626; color: #ffffff !important; outline-color: #ef4444; }

input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-family: inherit; margin-top: 6px; margin-bottom: 16px; background-color: #ffffff;
}
input[type="color"] { padding: 0; height: 42px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
label { font-weight: 600; font-size: 0.95rem; color: #334155; }

/* תוויות צבעוניות עם פינות מעוגלות עדינות */
.label-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    transition: 0.2s ease;
}
.label-tag:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 20px; }
.articles-list { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }

.card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
    display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--border);
}
.articles-list .card {
    flex-direction: row; align-items: center; padding: 18px 24px; gap: 20px;
}
.articles-list .card .card-content-wrap { flex: 1; }
.articles-list .card .btn { align-self: center !important; }

.card-title { font-size: 1.4rem; margin-bottom: 10px; color: var(--text-main); font-weight: 700; }
.articles-list .card-title { font-size: 1.15rem; margin-bottom: 4px; }
.card-meta { font-size: 0.9rem; color: var(--text-light); margin-bottom: 15px; }
.articles-list .card-meta { margin-bottom: 0; }

.card-labels { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 15px; }
.articles-list .card-labels { margin-bottom: 0; display: inline-flex; margin-right: 15px; }

/* שדרוג פלטת הצבעים המעגלית (עיצוב מודרני לבחירת ערכת צבעים) */
.color-palette-picker { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 25px; }
.color-swatch {
    width: 34px; height: 34px; border-radius: 50%;
    background-color: var(--swatch-color); cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}
.color-swatch:hover { transform: scale(1.1); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.color-swatch.active { border: 2px solid #fff; outline: 3px solid var(--swatch-color); }

.swatch-box { display: flex; gap: 8px; flex-wrap: wrap; margin-top: -6px; margin-bottom: 15px; }
.swatch { width: 25px; height: 25px; border-radius: 4px; cursor: pointer; border: 1px solid rgba(0,0,0,0.1); transition: 0.2s; }
.swatch:hover { transform: scale(1.1); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

/* מבנה לוח הניהול ותפריט צד */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { 
    width: 260px; 
    min-width: 260px; 
    flex-shrink: 0; 
    background: #fff; 
    border-left: 1px solid var(--border); 
    padding: 25px 20px; 
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.sidebar h2, .sidebar-header h2 { font-size: 1.3rem; color: var(--primary); font-weight: 700; margin: 0; }
.sidebar a, .sidebar-menu a { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    padding: 10px 14px; 
    border-radius: var(--radius); 
    margin-bottom: 6px; 
    color: var(--text-main); 
    font-weight: 600; 
    text-decoration: none; 
    transition: background 0.2s, color 0.2s; 
}
.sidebar a:hover, .sidebar a.active, .sidebar-menu a:hover, .sidebar-menu a.active { 
    background: var(--bg); 
    color: var(--primary); 
}
.main-content { flex: 1; padding: 35px 40px; }
.mobile-toggle-btn { display: none; }

.article-view { max-width: 800px; margin: 0 auto; background: #fff; padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }

/* יישור כותרת (H2) ותאריך על אותה שורה */
.title-date-wrapper {
    display: flex; align-items: baseline; gap: 15px; margin-bottom: 10px; flex-wrap: wrap;
}
.article-view h1, .title-date-wrapper h1 { font-size: 2.5rem; margin: 0; }
.article-view h2, .title-date-wrapper h2 { font-size: 1.8rem; margin: 0; }

.article-content { margin-top: 30px; font-size: 1.15rem; line-height: 1.8; }
.article-content h2, .article-content h3 { margin-top: 1.5em; margin-bottom: 0.5em; font-weight: 700; }
.article-content img { max-width: 100%; height: auto; border-radius: var(--radius); }

.view-switcher { display: flex; gap: 5px; background: #e2e8f0; padding: 3px; border-radius: var(--radius); }
.view-switch-btn { background: transparent; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--text-light); }
.view-switch-btn.active { background: #ffffff; color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

/* Sticky Editor Header */
.sticky-editor-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(5px);
    padding: 15px 24px; margin: -24px -24px 20px -24px;
    border-bottom: 1px solid var(--border); display: flex;
    justify-content: space-between; align-items: center;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 2px 4px -2px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .sidebar { width: 100%; min-width: 100%; border-left: none; border-bottom: 1px solid var(--border); padding: 15px 20px; }
    .sidebar-header { margin-bottom: 0; }
    .mobile-toggle-btn {
        display: inline-flex; align-items: center; justify-content: center;
        background: #f1f5f9; border: 1px solid var(--border); border-radius: var(--radius);
        width: 38px; height: 38px; font-size: 1.2rem; cursor: pointer; color: var(--text-main);
    }
    .sidebar-menu { display: none; margin-top: 15px; border-top: 1px solid var(--border); padding-top: 10px; }
    .sidebar-menu.open { display: block; }
    .theme-styling-options { display: none !important; }
    .main-content { padding: 20px; }
    .article-view { padding: 20px; }
    .articles-list .card { flex-direction: column; align-items: flex-start; }
}