/* XTech Marketing Platform — Custom Styles */

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1e2a3a;
    --sidebar-text: #c8d3e0;
    --sidebar-hover-bg: rgba(255,255,255,0.07);
    --sidebar-active-bg: #0d6efd;
    --sidebar-active-text: #fff;
    --topbar-height: 56px;
    --body-bg: #f0f2f5;
}

body {
    background-color: var(--body-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
}

/* ─── Sidebar ─────────────────────────────────────── */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

#sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

#sidebar .sidebar-brand .brand-icon {
    width: 30px;
    height: 30px;
    background: var(--sidebar-active-bg);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

#sidebar .sidebar-section {
    padding: 18px 0 6px;
    flex: 1;
}

#sidebar .sidebar-heading {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(200,211,224,0.45);
    padding: 4px 20px 6px;
    margin-top: 4px;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    padding: 8px 20px;
    border-radius: 0;
    font-size: 0.84rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

#sidebar .nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: #fff;
}

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

#sidebar .nav-link .bi {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

#sidebar .sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

#sidebar .user-menu-wrap {
    position: relative;
}

#sidebar .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity .15s;
}

#sidebar .user-avatar:hover { opacity: .85; }

#sidebar .user-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 200px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    overflow: hidden;
    z-index: 200;
}

#sidebar .user-dropdown.show { display: block; }

#sidebar .user-dropdown-header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid #f0f0f0;
}

#sidebar .user-dropdown-name {
    font-size: .85rem;
    font-weight: 600;
    color: #212529;
    line-height: 1.2;
}

#sidebar .user-dropdown-role {
    font-size: .72rem;
    color: #6c757d;
    text-transform: capitalize;
}

#sidebar .user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: .85rem;
    color: #343a40;
    text-decoration: none;
    transition: background .1s;
}

#sidebar .user-dropdown-item:hover { background: #f8f9fa; }
#sidebar .user-dropdown-item.active { background: #e8f0fe; color: #0d6efd; font-weight: 500; }
#sidebar .user-dropdown-item.text-danger { color: #dc3545 !important; }
#sidebar .user-dropdown-divider { height: 1px; background: #f0f0f0; margin: 4px 0; }
#sidebar .user-avatar.ring { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0d6efd; }

/* ─── Main Wrapper ─────────────────────────────────── */
#main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Top Bar ──────────────────────────────────────── */
#topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e3e8ef;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
    gap: 16px;
}

#topbar .page-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e2a3a;
    flex: 1;
}

/* ─── Content ──────────────────────────────────────── */
#content {
    padding: 24px;
    flex: 1;
}

/* ─── Cards ────────────────────────────────────────── */
.card {
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e3e8ef;
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
    padding: 14px 18px;
}

/* ─── Stat Cards ───────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e3e8ef;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e2a3a;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: #6c757d;
    margin-top: 3px;
}

/* ─── Tables ───────────────────────────────────────── */
.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

/* ─── Pipeline / Kanban ────────────────────────────── */
.pipeline-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: flex-start;
}

.pipeline-col {
    flex: 0 0 240px;
    background: #f8f9fb;
    border-radius: 10px;
    border: 1px solid #e3e8ef;
}

.pipeline-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #e3e8ef;
}

.pipeline-col-header .stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.pipeline-col-body {
    padding: 10px;
    min-height: 120px;
}

.deal-card {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: box-shadow 0.15s;
}

.deal-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.deal-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.pipeline-col.drag-over {
    background: #e8f0fe;
    border-color: #0d6efd;
}

/* ─── Activity Timeline ────────────────────────────── */
.activity-timeline {
    position: relative;
    padding-left: 28px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e3e8ef;
}

.activity-item {
    position: relative;
    padding-bottom: 16px;
}

.activity-dot {
    position: absolute;
    left: -24px;
    top: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #6c757d;
}

/* ─── Tag Badges ───────────────────────────────────── */
.tag-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #fff;
    line-height: 1.6;
}

/* ─── Forms ────────────────────────────────────────── */
.form-label {
    font-weight: 500;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

/* ─── Empty State ──────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #6c757d;
}

.empty-state .bi {
    font-size: 2.5rem;
    opacity: 0.4;
    display: block;
    margin-bottom: 12px;
}

/* ─── Login Page ───────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

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

.login-logo .logo-icon {
    width: 52px;
    height: 52px;
    background: #0d6efd;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 12px;
}

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.open {
        transform: translateX(0);
    }
    #main-wrapper {
        margin-left: 0;
    }
}

/* ─── Collapsible nav groups ───────────────────────── */
.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 7px 16px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 6px;
    margin: 2px 0;
    transition: color .15s, background .15s;
}
.nav-group-toggle:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.nav-group-toggle.open  { color: #e2e8f0; }
.nav-group-toggle span  { display: flex; align-items: center; gap: 8px; }

.toggle-chevron {
    font-size: .65rem;
    transition: transform .2s;
    opacity: .6;
}
.nav-group-toggle.open .toggle-chevron { transform: rotate(90deg); }

.nav-group {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}
.nav-group.show { max-height: 600px; }

/* Sub-items: slightly indented + smaller */
.nav-link.sub {
    padding-left: 2.4rem;
    font-size: .78rem;
    opacity: .8;
}
.nav-link.sub:hover,
.nav-link.sub.active { opacity: 1; }
