/* =============================================
   Arabic CRM - Main Stylesheet
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --dark: #1e293b;
    --darker: #0f172a;
    --light: #f8fafc;
    --border: #e2e8f0;
    --sidebar-w: 260px;
    --header-h: 60px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.1);
    --font: 'Noto Kufi Arabic', sans-serif;
}

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

body {
    font-family: var(--font);
    font-size: 14px;
    background: #f1f5f9;
    color: var(--dark);
    direction: rtl;
    line-height: 1.7;
    min-height: 100vh;
}

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

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--darker);
    color: #fff;
    z-index: 1000;
    overflow-y: auto;
    transition: transform .3s;
}
.sidebar-brand {
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand span { color: var(--primary); font-size: 22px; }
.sidebar-nav { padding: 10px 0; }
.sidebar-nav .nav-section {
    padding: 12px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    letter-spacing: 1px;
    font-weight: 600;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,.7);
    font-size: 13px;
    transition: .2s;
    border-right: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,.06);
    color: #fff;
    border-right-color: var(--primary);
}
.sidebar-nav a .icon { width: 20px; text-align: center; font-size: 15px; }
.sidebar-nav .badge {
    margin-right: auto;
    margin-left: 0;
    font-size: 10px;
}

/* ---- Header ---- */
.top-header {
    position: fixed;
    top: 0;
    right: var(--sidebar-w);
    left: 0;
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
}
.top-header .menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--dark);
}
.header-actions { display: flex; align-items: center; gap: 16px; }
.header-actions .notif-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--secondary);
}
.header-actions .notif-btn .dot {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
    transition: .2s;
}
.user-dropdown:hover { background: var(--light); }
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.user-info { font-size: 13px; }
.user-info small { display: block; color: var(--secondary); font-size: 11px; }

/* ---- Main Content ---- */
.main-content {
    margin-right: var(--sidebar-w);
    padding-top: var(--header-h);
    min-height: 100vh;
}
.content-wrapper {
    padding: 24px;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h4 { font-size: 20px; font-weight: 700; margin: 0; }
.breadcrumb { font-size: 12px; margin: 0; padding: 0; background: none; }
.breadcrumb a { color: var(--secondary); }

/* ---- Cards ---- */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: #fff;
    margin-bottom: 20px;
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-body { padding: 20px; }

/* ---- Stat Cards ---- */
.stat-card {
    border-radius: var(--radius);
    padding: 20px;
    background: #fff;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: .2s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-info h3 { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.2; }
.stat-info p { margin: 0; font-size: 12px; color: var(--secondary); }

/* ---- Tables ---- */
.table { font-size: 13px; }
.table thead th {
    background: var(--light);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
    padding: 12px 16px;
}
.table td { padding: 10px 16px; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ---- Badge ---- */
.badge {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
}

/* ---- Buttons ---- */
.btn { font-size: 13px; border-radius: 8px; padding: 8px 16px; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-action { padding: 4px 8px; font-size: 12px; }

/* ---- Forms ---- */
.form-control, .form-select {
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-label { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.input-group-text { font-size: 13px; border-radius: 8px; }

/* ---- Filters ---- */
.filter-bar {
    background: #fff;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.filter-bar .row { gap: 0; }

/* ---- Flash Messages ---- */
.alert { border-radius: var(--radius); font-size: 13px; border: none; }

/* ---- Modal ---- */
.modal-content { border-radius: var(--radius); border: none; }
.modal-header { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--border); padding: 12px 20px; }

/* ---- Activity Timeline ---- */
.timeline { list-style: none; padding: 0; }
.timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 8px;
    flex-shrink: 0;
}
.timeline-time { color: var(--secondary); font-size: 11px; }

/* ---- Pipeline / Kanban ---- */
.pipeline-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; }
.pipeline-col {
    min-width: 280px;
    flex: 1;
    background: var(--light);
    border-radius: var(--radius);
    padding: 12px;
}
.pipeline-col-header {
    font-weight: 600;
    font-size: 14px;
    padding: 8px 4px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pipeline-col-header .count {
    background: rgba(0,0,0,.08);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.deal-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: .2s;
}
.deal-card:hover { box-shadow: var(--shadow-lg); }
.deal-card h6 { font-size: 13px; margin-bottom: 6px; }
.deal-card .deal-value { font-size: 15px; font-weight: 700; color: var(--primary); }
.deal-card .deal-meta { font-size: 11px; color: var(--secondary); }

/* ---- Print ---- */
@media print {
    .sidebar, .top-header, .no-print { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .content-wrapper { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .top-header { right: 0; }
    .top-header .menu-toggle { display: block; }
    .main-content { margin-right: 0; }
    .pipeline-board { flex-direction: column; }
    .pipeline-col { min-width: 100%; }
}
@media (max-width: 576px) {
    .content-wrapper { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stat-card { padding: 14px; }
    .stat-icon { width: 40px; height: 40px; font-size: 18px; }
    .stat-info h3 { font-size: 20px; }
}

/* ---- Utility ---- */
.text-primary { color: var(--primary) !important; }
.bg-primary-light { background: var(--primary-light) !important; }
.bg-success-light { background: #d1fae5 !important; }
.bg-warning-light { background: #fef3c7 !important; }
.bg-danger-light { background: #fee2e2 !important; }
.bg-info-light { background: #cffafe !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.fw-600 { font-weight: 600; }
.fs-sm { font-size: 12px; }
.fs-xs { font-size: 11px; }
.cursor-pointer { cursor: pointer; }
.border-start-primary { border-right: 3px solid var(--primary) !important; border-left: none !important; }
.border-start-success { border-right: 3px solid var(--success) !important; border-left: none !important; }
.border-start-warning { border-right: 3px solid var(--warning) !important; border-left: none !important; }
.border-start-danger { border-right: 3px solid var(--danger) !important; border-left: none !important; }
