@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #0ea5e9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --header-height: 65px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    direction: rtl;
    line-height: 1.6;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: #fff;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
}

.sidebar-logo h2 {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-nav { padding: 16px 12px; }

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    padding: 0 12px;
    margin-bottom: 8px;
    font-weight: 500;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--gray-300);
    transition: all 0.2s;
    margin-bottom: 2px;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-item .badge {
    margin-right: auto;
    margin-left: 0;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: var(--sidebar-width);
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 90;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.header-user:hover { background: var(--gray-100); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    font-size: 18px;
    color: var(--gray-500);
}

.notification-btn:hover { background: var(--gray-100); }

.notification-btn .count {
    position: absolute;
    top: 2px;
    left: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-right: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 28px;
    min-height: calc(100vh - var(--header-height));
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.card-body { padding: 20px; }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-info h4 {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: var(--gray-500);
}

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--gray-50);
    padding: 12px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

tr:hover { background: var(--gray-50); }

/* ===== BADGES ===== */
.badge-priority, .badge-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-urgent { background: #fef2f2; color: #dc2626; }
.badge-high { background: #fff7ed; color: #ea580c; }
.badge-normal { background: #eff6ff; color: #2563eb; }
.badge-low { background: #f8fafc; color: #64748b; }

.badge-new, .badge-open { background: #faf5ff; color: #9333ea; }
.badge-in_progress { background: #fffbeb; color: #d97706; }
.badge-review { background: #eff6ff; color: #2563eb; }
.badge-done, .badge-resolved, .badge-closed { background: #f0fdf4; color: #16a34a; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-600); }
.btn-outline:hover { background: var(--gray-50); }

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s;
    direction: rtl;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 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 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    padding-left: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ===== SELECT MULTIPLE ===== */
select[multiple] {
    min-height: 120px;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===== KANBAN ===== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    min-height: 500px;
}

.kanban-column {
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 16px;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-300);
}

.kanban-column-header h4 {
    font-size: 14px;
    font-weight: 700;
}

.kanban-column-header .count {
    background: var(--gray-300);
    color: var(--gray-700);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.kanban-card {
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kanban-card h5 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--gray-500);
}

/* ===== COMMENTS ===== */
.comment {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}

.comment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.comment-content { flex: 1; }

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.comment-header strong { font-size: 14px; }

.comment-header .role-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 4px;
    background: var(--gray-100);
    color: var(--gray-500);
}

.comment-header time {
    font-size: 12px;
    color: var(--gray-400);
}

.comment-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--gray-700);
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
    background: var(--gray-200);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.5s ease;
}

/* ===== ACTIVITY LOG ===== */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-info p {
    font-size: 14px;
    color: var(--gray-700);
}

.activity-info time {
    font-size: 12px;
    color: var(--gray-400);
}

/* ===== FILTERS BAR ===== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters-bar select, .filters-bar input {
    padding: 8px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    direction: rtl;
    background: #fff;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--gray-500);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ===== NOTIFICATION LIST ===== */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s;
}

.notification-item:hover { background: var(--gray-50); }
.notification-item.unread { background: #eff6ff; }

.notification-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.notification-item.unread .dot { background: var(--danger); }

/* ===== DETAIL PAGE ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

.detail-sidebar .info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

.detail-sidebar .info-item .label {
    color: var(--gray-500);
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--gray-100);
    border-radius: 6px;
    font-size: 12px;
    color: var(--gray-600);
    margin: 2px;
}

/* ===== VISIBILITY BADGE ===== */
.badge-visibility {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 6px;
}

.badge-public { background: #ecfdf5; color: #059669; }
.badge-private { background: #fef3c7; color: #d97706; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, #312e81 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 24px;
    color: var(--gray-900);
}

.login-card p {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 32px;
    font-size: 14px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo .icon {
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    font-weight: 800;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .header {
        right: 0;
    }

    .main-content {
        margin-right: 0;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== SPRINT PROGRESS ===== */
.sprint-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 16px;
}

.sprint-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sprint-dates {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

/* ===== TICKET LINK ===== */
.ticket-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--info);
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.ticket-link:hover { opacity: 0.9; color: #fff; }

/* ===== HAMBURGER ===== */
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-700);
    padding: 4px;
}

@media (max-width: 768px) {
    .hamburger { display: block; }
}

/* ===== OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active { display: block; }

/* ===== ACTIONS ===== */
.actions {
    display: flex;
    gap: 8px;
}
