/* ============================================================
   TMS Pro - Main Stylesheet
   Design: Dark sidebar + clean white content area
   Font: Plus Jakarta Sans
   ============================================================ */

/* ── CSS Variables ──────────────────────────────────────── */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topnav-height: 64px;

    --color-primary:     #4361ee;
    --color-primary-dark:#3451d1;
    --color-success:     #2ecc71;
    --color-warning:     #f39c12;
    --color-danger:      #e74c3c;
    --color-info:        #3498db;

    --sidebar-bg:        #0f1520;
    --sidebar-text:      #8b96b0;
    --sidebar-hover:     rgba(255,255,255,0.07);
    --sidebar-active:    rgba(67,97,238,0.18);
    --sidebar-active-text:#7b9cf0;

    --bg-body:           #f0f4fb;
    --bg-card:           #ffffff;
    --text-primary:      #1a2035;
    --text-muted:        #8896b3;
    --border-color:      #e8ecf5;

    --shadow-sm:  0 1px 6px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg:  0 8px 40px rgba(0,0,0,0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition: all .22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 10px; }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow-x: hidden;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: var(--topnav-height);
}

.sidebar-brand-icon {
    width: 38px; height: 38px;
    background: var(--color-primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(67,97,238,0.4);
}

.brand-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}
.brand-sub {
    display: block;
    font-size: 10px;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(139,150,176,0.5);
    padding: 14px 10px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
    margin-bottom: 2px;
}

.sidebar-nav .nav-link i {
    font-size: 17px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,0.9);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    flex-shrink: 0;
}
.sidebar-user-name {
    font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.85);
    white-space: nowrap;
}
.sidebar-user-role {
    font-size: 11px; color: var(--sidebar-text);
    white-space: nowrap;
}

/* Collapsed state */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .brand-sub {
    display: none;
}
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 16px; }
.sidebar.collapsed .sidebar-nav .nav-link { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-footer { padding: 12px 8px; }
.sidebar.collapsed .sidebar-user { justify-content: center; }

/* ═══════════════════════════════════════════════════════════
   MAIN WRAPPER & TOPNAV
═══════════════════════════════════════════════════════════ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}
.main-wrapper.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* Topnav */
.topnav {
    height: var(--topnav-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    width: 38px; height: 38px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: var(--text-muted);
    transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-body); color: var(--text-primary); }

.topnav-title h6 { color: var(--text-primary); font-size: 15px; }

.topnav-btn {
    width: 38px; height: 38px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    color: var(--text-muted);
    transition: var(--transition);
}
.topnav-btn:hover { background: var(--bg-body); color: var(--text-primary); }

.notif-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 18px; height: 18px;
    background: var(--color-danger);
    color: white;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
}

.topnav-user {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.topnav-user:hover { background: var(--bg-body); }
.topnav-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.topnav-username { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.topnav-role { font-size: 11px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   PAGE CONTENT
═══════════════════════════════════════════════════════════ */
.page-content {
    padding: 24px;
    flex: 1;
}

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

/* ═══════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Stat Cards */
.stat-card {
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    color: white;
    position: relative;
    overflow: hidden;
    border: none;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-card .stat-icon {
    font-size: 42px;
    opacity: 0.25;
    position: absolute;
    right: 16px; top: 16px;
}
.stat-card .stat-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
}
.stat-card .stat-label {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 4px;
    font-weight: 500;
}
.stat-card .stat-change {
    font-size: 12px;
    margin-top: 10px;
    opacity: 0.9;
}

.stat-blue   { background: linear-gradient(135deg, #4361ee, #7695ff); }
.stat-green  { background: linear-gradient(135deg, #0ab39c, #02a89a); }
.stat-orange { background: linear-gradient(135deg, #f39c12, #e74c3c); }
.stat-purple { background: linear-gradient(135deg, #7b2d8b, #a855f7); }
.stat-red    { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-teal   { background: linear-gradient(135deg, #3498db, #2980b9); }

/* ═══════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════ */
.table {
    font-size: 13.5px;
}
.table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    padding: 10px 16px;
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.table tbody tr:hover { background: rgba(67,97,238,0.03); }
.table tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════ */
.form-label { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 5px; }
.form-control, .form-select {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    padding: 9px 14px;
    transition: var(--transition);
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
}
textarea.form-control { resize: vertical; min-height: 90px; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    transition: var(--transition);
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(67,97,238,0.3);
}
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 6px 10px; }

/* ═══════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════ */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

/* Priority Dots */
.priority-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}
.priority-low    .priority-dot { background: var(--color-success); }
.priority-medium .priority-dot { background: var(--color-info); }
.priority-high   .priority-dot { background: var(--color-warning); }
.priority-critical .priority-dot { background: var(--color-danger); }

/* ═══════════════════════════════════════════════════════════
   NOTIFICATION DROPDOWN
═══════════════════════════════════════════════════════════ */
.notif-dropdown {
    width: 340px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.notif-header {
    padding: 14px 16px;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.notif-item:hover { background: var(--bg-body); }
.notif-item.unread { background: rgba(67,97,238,0.04); }
.notif-icon {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.notif-icon.type-task    { background: rgba(67,97,238,0.12); color: var(--color-primary); }
.notif-icon.type-comment { background: rgba(46,204,113,0.12); color: var(--color-success); }
.notif-icon.type-system  { background: rgba(243,156,18,0.12);  color: var(--color-warning); }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-msg   { font-size: 12px; color: var(--text-muted); }
.notif-time  { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.notif-footer { text-align: center; padding: 10px; font-size: 12px; }
.notif-empty { text-align: center; padding: 28px 16px; }
.notif-empty i { font-size: 28px; display: block; margin-bottom: 8px; }

/* ═══════════════════════════════════════════════════════════
   PROGRESS BARS
═══════════════════════════════════════════════════════════ */
.progress {
    height: 6px;
    border-radius: 10px;
    background: var(--border-color);
}
.progress-bar { border-radius: 10px; }

/* ═══════════════════════════════════════════════════════════
   TASK KANBAN VIEW
═══════════════════════════════════════════════════════════ */
.kanban-col-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.kanban-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    background: white;
    margin-bottom: 10px;
    transition: var(--transition);
    cursor: pointer;
}
.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════
   USER AVATAR STACKED
═══════════════════════════════════════════════════════════ */
.avatar-group { display: flex; }
.avatar-group .avatar-xs {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid white;
    margin-left: -8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: white;
    flex-shrink: 0;
}
.avatar-group .avatar-xs:first-child { margin-left: 0; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1520 0%, #1a2540 50%, #0f1520 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    width: 100%; max-width: 420px;
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
    width: 56px; height: 56px;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: white;
    margin: 0 auto 20px;
    box-shadow: 0 8px 20px rgba(67,97,238,0.4);
}

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; opacity: 0.4; }
.empty-state h6 { font-size: 15px; color: var(--text-primary); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .page-content { padding: 16px; }
}

/* ─── Alert customization ────────────────────────────────── */
.alert {
    border-radius: var(--radius-md);
    font-size: 13.5px;
    border: none;
    padding: 12px 16px;
}

/* ─── Dropdown ───────────────────────────────────────────── */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
}
.dropdown-item {
    padding: 8px 16px;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 6px;
}
.dropdown-item:hover { background: var(--bg-body); color: var(--color-primary); }

/* ─── Pagination ─────────────────────────────────────────── */
.page-link {
    border-radius: var(--radius-sm) !important;
    font-size: 13px;
    font-weight: 500;
    margin: 0 2px;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.page-item.active .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
