/* =========================================================
   ProjectMon - Custom Theme
   ========================================================= */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --info: #06b6d4;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;

    --sidebar-bg: #1e293b;
    --sidebar-bg-hover: #334155;
    --sidebar-text: #cbd5e1;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;

    --topbar-height: 64px;
    --content-bg: #f1f5f9;

    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -1px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.05);

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* =========================================================
   LAYOUT
   ========================================================= */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: var(--sidebar-text);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform .3s ease;
    box-shadow: 4px 0 10px rgba(0,0,0,.05);
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -.3px;
}

.sidebar-brand i {
    font-size: 1.5rem;
    margin-right: .65rem;
    background: linear-gradient(135deg, #818cf8, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-section {
    padding: 1.25rem 1rem .5rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 600;
}

.sidebar-menu { list-style: none; padding: 0; margin: 0; }
.sidebar-menu li { margin: 2px .5rem; }
.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: .65rem .85rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    transition: all .2s;
    font-size: .9rem;
    cursor: pointer;
}
.sidebar-menu a:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}
.sidebar-menu a.active {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(79,70,229,.35);
}
.sidebar-menu a i {
    width: 20px;
    margin-right: .75rem;
    font-size: 1rem;
}
.sidebar-menu .submenu-toggle::after {
    content: '\f282';
    font-family: 'bootstrap-icons';
    margin-left: auto;
    font-size: .8rem;
    transition: transform .2s;
}
.sidebar-menu .submenu-toggle.open::after { transform: rotate(90deg); }
.sidebar-submenu {
    list-style: none;
    padding-left: 0;
    margin: 4px 0 0 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}
.sidebar-submenu.show { max-height: 500px; }
.sidebar-submenu li a {
    padding-left: 2.8rem;
    font-size: .85rem;
}

/* =========================================================
   MAIN
   ========================================================= */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.topbar .menu-toggle {
    background: none;
    border: 0;
    font-size: 1.4rem;
    color: var(--text-secondary);
    margin-right: 1rem;
    cursor: pointer;
    display: none;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--content-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s;
    position: relative;
    border: 0;
}
.topbar-icon:hover { background: #e2e8f0; color: var(--primary); }
.topbar-icon .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: .55rem;
    padding: 3px 5px;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .25rem .65rem .25rem .25rem;
    border-radius: 50px;
    background: var(--content-bg);
    cursor: pointer;
    border: 0;
}
.user-dropdown:hover { background: #e2e8f0; }
.user-dropdown .user-name { font-weight: 600; font-size: .85rem; }
.user-dropdown .user-role { font-size: .7rem; color: var(--text-secondary); }

.page-content { padding: 1.5rem; }

/* =========================================================
   CARDS / WIDGETS
   ========================================================= */
.card {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: #fff;
    margin-bottom: 1.25rem;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h5, .card-header h6 { margin: 0; font-weight: 700; color: var(--text-primary); }
.card-body { padding: 1.25rem; }

.stat-card {
    border-radius: var(--radius);
    padding: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    height: 100%;
    box-shadow: var(--shadow);
}
.stat-card::before {
    content: '';
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    top: -50px;
    right: -50px;
}
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255,255,255,.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: .25rem; }
.stat-card .stat-label { font-size: .85rem; opacity: .9; }
.stat-card.bg-grad-1 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.stat-card.bg-grad-2 { background: linear-gradient(135deg, #06b6d4, #0ea5e9); }
.stat-card.bg-grad-3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.stat-card.bg-grad-4 { background: linear-gradient(135deg, #10b981, #059669); }

/* =========================================================
   AVATAR
   ========================================================= */
.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.avatar-group { display: inline-flex; }
.avatar-group .avatar-initials,
.avatar-group img {
    border: 2px solid #fff;
    margin-left: -8px;
}
.avatar-group > *:first-child { margin-left: 0; }

/* =========================================================
   PROGRESS
   ========================================================= */
.progress-thin { height: 6px; border-radius: 10px; background: #e2e8f0; }
.progress-thin .progress-bar { border-radius: 10px; }

/* =========================================================
   KANBAN
   ========================================================= */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: flex-start;
}
.kanban-column {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 1rem;
    min-height: 60vh;
    border: 1px solid var(--border-color);
}
.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid;
}
.kanban-column[data-status="todo"] .kanban-column-header { border-color: #94a3b8; }
.kanban-column[data-status="in_progress"] .kanban-column-header { border-color: #3b82f6; }
.kanban-column[data-status="review"] .kanban-column-header { border-color: #06b6d4; }
.kanban-column[data-status="done"] .kanban-column-header { border-color: #10b981; }

.kanban-column-title {
    font-weight: 700;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.kanban-count {
    background: #fff;
    color: var(--text-secondary);
    padding: 2px 10px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.kanban-cards { min-height: 50px; }
.kanban-card {
    background: #fff;
    padding: .9rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    margin-bottom: .75rem;
    cursor: grab;
    border-left: 4px solid;
    transition: all .2s;
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kanban-card.priority-low { border-left-color: #10b981; }
.kanban-card.priority-medium { border-left-color: #06b6d4; }
.kanban-card.priority-high { border-left-color: #f59e0b; }
.kanban-card.priority-urgent { border-left-color: #ef4444; }
.kanban-card.dragging { opacity: .4; }
.kanban-cards.drag-over {
    background: #eef2ff;
    border-radius: var(--radius-sm);
    outline: 2px dashed var(--primary);
}

.kanban-card .kanban-card-title { font-weight: 600; margin-bottom: .35rem; font-size: .9rem; }
.kanban-card .kanban-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: .65rem; font-size: .75rem; color: var(--text-secondary); }
.kanban-card .kanban-project { font-size: .7rem; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* =========================================================
   GANTT
   ========================================================= */
.gantt-container {
    overflow-x: auto;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}
.gantt-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 1200px;
}
.gantt-table th, .gantt-table td {
    border: 1px solid var(--border-color);
    padding: 0;
    font-size: .8rem;
    vertical-align: middle;
}
.gantt-table thead th {
    background: #f8fafc;
    font-weight: 600;
    text-align: center;
    padding: .5rem;
    position: sticky;
    top: 0;
    z-index: 5;
}
.gantt-table .gantt-task-cell {
    padding: .65rem .75rem;
    min-width: 280px;
    background: #fff;
    position: sticky;
    left: 0;
    z-index: 4;
    border-right: 2px solid var(--border-color);
}
.gantt-table thead th.gantt-task-cell { z-index: 6; }
.gantt-day { width: 32px; height: 36px; }
.gantt-day.today { background: #fef3c7; }
.gantt-day.weekend { background: #f8fafc; }
.gantt-bar-cell { position: relative; height: 36px; padding: 0 !important; }
.gantt-bar {
    position: absolute;
    top: 6px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    color: #fff;
    font-size: .7rem;
    padding: 0 8px;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    transition: all .2s;
    z-index: 2;
}
.gantt-bar:hover { box-shadow: 0 0 0 2px rgba(79,70,229,.4); }
.gantt-bar.status-done { background: linear-gradient(135deg, #10b981, #059669); }
.gantt-bar.status-in_progress { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.gantt-bar.status-review { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.gantt-bar.status-todo { background: linear-gradient(135deg, #94a3b8, #64748b); }
.gantt-bar .gantt-progress {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    background: rgba(0,0,0,.25);
    border-radius: 4px 0 0 4px;
}

/* =========================================================
   TABLE
   ========================================================= */
.table {
    margin-bottom: 0;
}
.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    font-size: .75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: .5px;
    font-weight: 600;
    padding: .85rem 1rem;
}
.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: var(--border-color);
}
.table-hover tbody tr:hover { background: #f8fafc; }

/* =========================================================
   FORMS / BUTTONS
   ========================================================= */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
    padding: .55rem .85rem;
    font-size: .9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-label { font-weight: 600; font-size: .85rem; color: var(--text-primary); margin-bottom: .35rem; }

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: .55rem 1rem;
    font-size: .875rem;
    transition: all .2s;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 0;
    box-shadow: 0 2px 4px rgba(79,70,229,.25);
}
.btn-primary:hover {
    box-shadow: 0 4px 10px rgba(79,70,229,.4);
    transform: translateY(-1px);
}
.btn-icon { padding: .4rem .55rem; }

/* =========================================================
   LOGIN
   ========================================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}
.login-page::before, .login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}
.login-page::before {
    width: 400px; height: 400px;
    background: rgba(255,255,255,.15);
    top: -100px; right: -100px;
}
.login-page::after {
    width: 350px; height: 350px;
    background: rgba(236,72,153,.25);
    bottom: -100px; left: -100px;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}
.login-card .login-brand {
    text-align: center;
    margin-bottom: 2rem;
}
.login-card .login-brand i {
    font-size: 3rem;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-card h1 {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: .25rem;
}
.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.demo-creds {
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 1.5rem;
    font-size: .8rem;
}
.demo-creds h6 { font-weight: 700; margin-bottom: .5rem; font-size: .8rem; }
.demo-creds ul { margin: 0; padding-left: 1rem; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 992px) {
    :root { --sidebar-width: 0px; }
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar .menu-toggle { display: inline-flex; }
    .kanban-board { grid-template-columns: 1fr; }
}

/* =========================================================
   UTILITIES
   ========================================================= */
.text-muted-2 { color: var(--text-secondary); }
.fw-700 { font-weight: 700; }
.text-xs { font-size: .75rem; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}
.empty-state i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

/* Permission checkbox grid */
.perm-table td { padding: .5rem .75rem; }
.perm-checkbox { width: 18px; height: 18px; cursor: pointer; }
