/* Ejabat AI - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --font: 'IBM Plex Sans Arabic', -apple-system, sans-serif;
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.main-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }

/* ===== Navbar ===== */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.navbar-brand svg { width: 28px; height: 28px; }
.navbar-search {
    flex: 1;
    max-width: 500px;
    margin: 0 24px;
    position: relative;
}
.navbar-search input {
    width: 100%;
    padding: 8px 40px 8px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg);
    transition: all var(--transition);
}
.navbar-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.navbar-search svg {
    position: absolute;
    left: auto;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}
.navbar-links { display: flex; align-items: center; gap: 16px; }
.navbar-links a { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.navbar-links a:hover { color: var(--primary); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 600; }

/* ===== Question List ===== */
.question-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: all var(--transition);
}
.question-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}
.question-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.5;
}
.question-title a { color: var(--text); }
.question-title a:hover { color: var(--primary); }
.question-excerpt {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.6;
}
.question-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
}
.question-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.question-stats {
    display: flex;
    gap: 12px;
}
.stat-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg);
    color: var(--text-muted);
}
.stat-badge.has-answer { background: #dcfce7; color: #166534; }
.category-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

/* ===== Single Question Page ===== */
.question-page .question-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.question-page h1 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 12px;
}
.question-body { line-height: 1.8; margin-bottom: 16px; }
.question-body p { margin-bottom: 12px; }
.question-body h2, .question-body h3 { margin: 16px 0 8px; font-weight: 600; }
.question-body ul, .question-body ol { padding-right: 24px; margin-bottom: 12px; }
.question-body li { margin-bottom: 4px; }
.question-body code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.question-body pre { background: var(--bg); padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: 12px; }
.question-body blockquote { border-right: 3px solid var(--primary); padding: 8px 16px; margin: 12px 0; background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ===== Answers ===== */
.answers-section { margin-top: 20px; }
.answers-count {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
.answer-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.answer-item.accepted { border-color: var(--success); border-width: 2px; }
.accepted-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #dcfce7;
    color: #166534;
    margin-bottom: 8px;
}
.answer-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.answer-author img, .answer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    font-size: 14px;
}
.answer-author-info { display: flex; flex-direction: column; }
.answer-author-name { font-weight: 600; font-size: 14px; }
.answer-author-date { font-size: 12px; color: var(--text-light); }
.answer-body { line-height: 1.8; }
.answer-body p { margin-bottom: 12px; }
.answer-body h3, .answer-body h4 { margin: 16px 0 8px; font-weight: 600; }
.answer-body ul, .answer-body ol { padding-right: 24px; margin-bottom: 12px; }

/* ===== Voting ===== */
.vote-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
}
.vote-btn {
    background: none;
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    color: var(--text-muted);
}
.vote-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.vote-count { font-weight: 600; font-size: 16px; }

/* ===== Sidebar ===== */
.sidebar .card { margin-bottom: 16px; }
.sidebar-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}
.category-list { list-style: none; }
.category-list li { margin-bottom: 6px; }
.category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    transition: all var(--transition);
}
.category-list a:hover { background: var(--bg); color: var(--primary); }
.category-list .count {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 24px 0;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: all var(--transition);
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Footer ===== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    transition: all var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 32px; }

/* ===== Breadcrumb ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin: 16px 0;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { opacity: 0.5; }

/* ===== Alert ===== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: var(--primary-light); color: #1e40af; border: 1px solid #93c5fd; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .main-grid { grid-template-columns: 1fr; }
    .navbar-search { display: none; }
    .question-page h1 { font-size: 18px; }
    .container { padding: 0 12px; }
}
