/* ==========================================================
   ProManage — Light theme, bilingual (AR/EN) design system
   ========================================================== */

:root {
    --bg: #F6F7FB;
    --surface: #FFFFFF;
    --surface-alt: #F1F2F8;
    --border: #E4E6F0;
    --text: #1D2130;
    --text-muted: #6B7080;
    --text-faint: #9CA0B0;

    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-soft: #EEF0FF;

    --teal: #0F8C82;
    --teal-soft: #E4F5F3;

    --amber: #D97706;
    --amber-soft: #FEF3E2;

    --red: #DC2626;
    --red-soft: #FDE9E9;

    --green: #16A34A;
    --green-soft: #E8F7EE;

    --blue: #2563EB;
    --blue-soft: #EAF1FE;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(20, 22, 40, 0.06);
    --shadow-md: 0 8px 24px rgba(20, 22, 40, 0.08);
    --shadow-lg: 0 20px 48px rgba(20, 22, 40, 0.14);

    --font-ar: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    --font-en: 'Inter', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-en);
    -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body, [dir="rtl"] body { font-family: var(--font-ar); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
input, select, textarea { font-family: inherit; }

/* ---------- Buttons & form controls ---------- */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    transition: background .15s ease, transform .1s ease;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
}
.btn-secondary:hover { background: #E9EBF5; }

.btn-ghost-sm {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.btn-ghost-sm:hover { background: var(--surface); color: var(--text); }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--surface-alt); color: var(--text); }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 14px 0 6px;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; }

/* ==========================================================
   AUTH PAGE
   ========================================================== */
.auth-body { background: var(--bg); }
.auth-lang-toggle {
    position: fixed; top: 20px;
    inset-inline-end: 24px;
    z-index: 20;
}
.auth-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 460px 1fr;
}
@media (max-width: 900px) {
    .auth-wrapper { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
}
.auth-panel {
    background: var(--surface);
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-inline-end: 1px solid var(--border);
}
.brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 20px; margin-bottom: 40px;
}
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 800;
}
.auth-tabs {
    display: flex; gap: 4px;
    background: var(--surface-alt);
    padding: 4px; border-radius: 10px;
    margin-bottom: 28px;
}
.auth-tab {
    flex: 1; padding: 9px; border: none; background: transparent;
    border-radius: 8px; font-weight: 600; color: var(--text-muted); font-size: 14px;
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-form h1 { font-size: 26px; margin: 0 0 6px; }
.auth-subtitle { color: var(--text-muted); font-size: 14.5px; margin: 0 0 6px; }
.auth-form .btn-primary { width: 100%; margin-top: 22px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }
.auth-switch a { color: var(--primary); font-weight: 600; }
.auth-demo-hint { text-align: center; color: var(--text-faint); font-size: 12.5px; margin-top: 24px; }
.auth-error {
    background: var(--red-soft); color: var(--red);
    padding: 10px 14px; border-radius: var(--radius-sm);
    font-size: 13.5px; margin-bottom: 16px; font-weight: 600;
}

.auth-visual {
    background: radial-gradient(circle at 30% 20%, #EEF0FF 0%, #F6F7FB 60%);
    display: flex; align-items: center; justify-content: center;
}
.mock-board { display: flex; gap: 18px; }
.mock-col {
    width: 150px; background: var(--surface); border-radius: var(--radius-md);
    padding: 14px; box-shadow: var(--shadow-md);
    display: flex; flex-direction: column; gap: 10px;
}
.mock-col:nth-child(2) { transform: translateY(-24px); }
.mock-col:nth-child(3) { transform: translateY(14px); }
.mock-col-title { width: 60%; height: 10px; border-radius: 4px; background: var(--border); margin-bottom: 4px; }
.mock-card { height: 46px; border-radius: 8px; background: var(--surface-alt); border: 1px solid var(--border); }
.mock-card.short { height: 28px; }
.mock-col:nth-child(1) .mock-card:first-of-type { border-inline-start: 3px solid var(--blue); }
.mock-col:nth-child(2) .mock-card:first-of-type { border-inline-start: 3px solid var(--amber); }
.mock-col:nth-child(3) .mock-card { border-inline-start: 3px solid var(--green); }

/* ==========================================================
   APP SHELL
   ========================================================== */
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
@media (max-width: 860px) { .app-shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

.sidebar {
    background: var(--surface);
    border-inline-end: 1px solid var(--border);
    padding: 22px 16px;
    display: flex; flex-direction: column;
}
.sidebar .brand { margin: 4px 8px 28px; }
.nav-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin: 18px 10px 8px; font-weight: 700; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 600; font-size: 14.5px;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-alt); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.project-list { max-height: 260px; overflow-y: auto; }
.sidebar-footer { margin-top: auto; }

.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 68px; background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 18px; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-alt); border-radius: 20px;
    padding: 8px 14px; width: 220px;
}
.search-box input { border: none; background: transparent; padding: 0; width: 100%; font-size: 13.5px; }
.search-box input:focus { border: none; }

.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}

.content { padding: 24px; flex: 1; overflow-y: auto; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
@media (max-width: 760px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 18px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; margin: 4px 0; }
.stat-card .stat-label { color: var(--text-muted); font-size: 13.5px; font-weight: 600; }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 16px; }

/* ---------- Project cards ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.project-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 18px; cursor: pointer;
    transition: box-shadow .15s ease, transform .1s ease;
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.project-card h3 { margin: 6px 0 4px; font-size: 16px; }
.project-card p { color: var(--text-muted); font-size: 13.5px; margin: 0 0 14px; min-height: 18px; }
.progress-bar { background: var(--surface-alt); height: 6px; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--teal); border-radius: 4px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.new-project-card {
    border: 1.5px dashed var(--border); border-radius: var(--radius-md);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-muted); font-weight: 600; font-size: 14px; min-height: 130px;
    background: transparent;
}
.new-project-card:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ---------- Kanban board ---------- */
.board-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.kanban-column {
    background: var(--surface-alt); border-radius: var(--radius-md);
    width: 290px; min-width: 290px; padding: 12px; flex-shrink: 0;
}
.kanban-column-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 12px; }
.kanban-column-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.column-count { background: var(--surface); color: var(--text-muted); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; }
.kanban-cards { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.kanban-cards.drag-over { background: var(--primary-soft); border-radius: var(--radius-sm); }

.task-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px; cursor: grab;
    box-shadow: var(--shadow-sm);
}
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.4; }
.task-card h4 { margin: 0 0 8px; font-size: 14px; font-weight: 600; line-height: 1.4; }
.task-card-meta { display: flex; align-items: center; justify-content: space-between; }
.task-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; display: inline-block; }
.badge-low { background: var(--blue-soft); color: var(--blue); }
.badge-medium { background: var(--amber-soft); color: var(--amber); }
.badge-high { background: #FFE4D6; color: #C2410C; }
.badge-urgent { background: var(--red-soft); color: var(--red); }
.badge-overdue { background: var(--red-soft); color: var(--red); }

.add-task-btn {
    width: 100%; text-align: start; background: transparent; border: none;
    color: var(--text-muted); font-weight: 600; font-size: 13.5px;
    padding: 10px 8px; border-radius: var(--radius-sm);
}
.add-task-btn:hover { background: var(--surface); color: var(--primary); }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(20,22,40,.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
    box-shadow: var(--shadow-lg); padding: 26px;
}
.modal.modal-wide { max-width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-header h3 { margin: 0; font-size: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------- Comments ---------- */
.comments-section { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.comment { display: flex; gap: 10px; margin-bottom: 14px; }
.comment-body { background: var(--surface-alt); border-radius: var(--radius-sm); padding: 10px 12px; flex: 1; }
.comment-author { font-weight: 700; font-size: 13px; }
.comment-time { color: var(--text-faint); font-size: 11.5px; }
.comment-text { font-size: 13.5px; margin-top: 4px; }
.comment-input-row { display: flex; gap: 10px; margin-top: 14px; }
.comment-input-row textarea { flex: 1; min-height: 44px; }

/* ---------- Notifications dropdown ---------- */
.notif-wrapper { position: relative; }
.notif-dot { position: absolute; top: 4px; inset-inline-end: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); }
.notif-dropdown {
    position: absolute; top: 46px; inset-inline-end: 0;
    width: 320px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 30;
    max-height: 380px; overflow-y: auto;
}
.notif-dropdown[hidden] { display: none; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--primary-soft); }
.notif-empty { padding: 30px; text-align: center; color: var(--text-faint); font-size: 13.5px; }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.toast {
    position: fixed; bottom: 24px; inset-inline-start: 50%;
    transform: translateX(-50%); background: var(--text); color: #fff;
    padding: 12px 22px; border-radius: 30px; font-size: 13.5px; font-weight: 600;
    box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; transition: opacity .2s ease;
}
[dir="rtl"] .toast { transform: translateX(50%); }
.toast.show { opacity: 1; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D6D9E5; border-radius: 4px; }
