/* Agent DNA CRM shell - matches client.agent-dna.com visual style */

:root {
    --tenant-colour-primary: #3d52d5;
    --tenant-colour-secondary: #5b6cf5;
    --nav-btn-hover-bg-color: #f3f4f6;
    --nav-btn-hover-text-color: #1a1a1a;
    --primary-bg-color: #f8f9fa;
    --secondary-bg-color: #ffffff;
    --tertiary-bg-color: var(--primary-bg-color);
    --primary-text-color: black;
    --border-color: #e2e8f0;
    --navbar-text-color: #6b7280;
    --dark-mode-nav-text-color: rgba(255, 255, 255, 0.698);
    --drawer-bg: #ffffff;
}

.dark-mode {
    --nav-btn-hover-bg-color: rgba(55, 55, 64, 1);
    --nav-btn-hover-text-color: rgba(255, 255, 255, 0.698);
    --primary-bg-color: #2C2D32;
    --secondary-bg-color: rgba(55, 55, 64, 1);
    --tertiary-bg-color: #2e2e38;
    --primary-text-color: rgba(255, 255, 255, 0.698);
    --border-color: rgba(255, 255, 255, 0.3);
    --navbar-text-color: rgba(255, 255, 255, 0.698);
    --drawer-bg: rgba(45, 45, 52, 1);
    --tenant-colour-primary: #888888;
    --tenant-colour-secondary: #888888;
}

body {
    font-family: 'Roboto', 'Montserrat', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--primary-bg-color);
    color: var(--primary-text-color);
    -webkit-font-smoothing: antialiased;
}

/* ── App shell ── */

.agentdna-shell {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.agentdna-body {
    display: flex;
    height: calc(100vh - 64px);
    margin-top: 64px;
    overflow: hidden;
}

/* ── Top nav ── */

.top-nav {
    background: var(--secondary-bg-color);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.dark-mode .top-nav {
    border-bottom: 1px solid #606060;
}

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

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.tenant-name {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--tenant-colour-primary) 0%, var(--tenant-colour-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Poppins', 'Montserrat', sans-serif;
}

.hamburger-btn,
.nav-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--navbar-text-color);
    flex-shrink: 0;
}

.hamburger-btn:hover,
.nav-icon-btn:hover {
    background: var(--nav-btn-hover-bg-color);
}

.hamburger-btn svg,
.nav-icon-btn svg {
    width: 20px;
    height: 20px;
}

.user-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--tenant-colour-primary) 0%, var(--tenant-colour-secondary) 100%);
    transition: all 0.2s;
    font-family: 'Roboto', sans-serif;
    border: none;
    flex-shrink: 0;
    user-select: none;
}

.user-avatar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(61, 82, 213, 0.4);
}

.user-dropdown {
    position: absolute;
    top: 52px;
    right: 0;
    background: var(--secondary-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    min-width: 220px;
    z-index: 200;
    overflow: hidden;
}

.dark-mode .user-dropdown {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.user-dropdown-name {
    padding: 16px 16px 4px;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-text-color);
    font-family: 'Roboto', sans-serif;
}

.user-dropdown-email {
    padding: 0 16px 12px;
    font-size: 12px;
    color: var(--navbar-text-color);
    font-family: 'Roboto', sans-serif;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--primary-text-color);
    transition: background 0.15s;
    font-family: 'Roboto', sans-serif;
    text-align: left;
}

.user-dropdown-item:hover {
    background: var(--nav-btn-hover-bg-color);
}

.user-dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ── Side nav ── */

.side-nav {
    width: 260px;
    background: var(--drawer-bg);
    height: 100%;
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    flex-shrink: 0;
    transition: width 0.25s ease, padding 0.25s ease;
}

.side-nav::-webkit-scrollbar { display: none; }

.dark-mode .side-nav {
    border-right: 1px solid #606060;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

.side-nav.collapsed {
    width: 0;
    padding-left: 0;
    padding-right: 0;
}

/* ── Nav sections ── */

.nav-section {
    padding: 0 16px 20px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.nav-section:last-child {
    border-bottom: none;
}

.dark-mode .nav-section {
    border-bottom: 1px solid #404040;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 16px 12px 12px 12px;
    user-select: none;
}

.nav-section-header:hover { opacity: 0.8; }
.nav-section-header.non-collapsible { cursor: default; }
.nav-section-header.non-collapsible:hover { opacity: 1; }

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: black;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    white-space: nowrap;
}

.dark-mode .nav-section-title { color: white; }

.nav-section-toggle {
    font-size: 16px;
    color: #9ca3af;
    transition: transform 0.2s;
}

.nav-section-toggle.collapsed { transform: rotate(-90deg); }

.nav-section-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.nav-section-content.collapsed {
    max-height: 0;
    opacity: 0;
}

/* ── Nav items ── */

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: #374151;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    white-space: nowrap;
}

.dark-mode .nav-item { color: var(--dark-mode-nav-text-color); }

.nav-item:hover {
    background: var(--nav-btn-hover-bg-color);
    color: var(--nav-btn-hover-text-color);
}

.dark-mode .nav-item:hover {
    background: var(--nav-btn-hover-bg-color);
    color: var(--dark-mode-nav-text-color);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--tenant-colour-primary) 0%, var(--tenant-colour-secondary) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(61, 82, 213, 0.3);
}

.dark-mode .nav-item.active {
    background: #333333;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.9);
}

.nav-item.active:hover {
    background: linear-gradient(135deg, #3246c0 0%, #4e5ee0 100%);
    color: white;
}

.nav-item > *:first-child {
    box-sizing: border-box;
    width: 22px;
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item > *:first-child svg,
.nav-item > *:first-child i,
.nav-item > *:first-child .lucide {
    display: block;
    width: 22px;
    height: 22px;
    max-width: 100%;
    max-height: 100%;
    font-size: 22px;
    line-height: 1;
}

.nav-badge {
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Main content area ── */

.main-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--primary-bg-color);
    padding: 32px 76px;
    color: var(--primary-text-color);
    overflow-x: hidden;
}

@media (max-width: 1200px) {
    .main-area { padding: 28px 32px; }
}

@media (max-width: 768px) {
    .main-area { padding: 20px 16px; }
}

/* ── Page header (matches Client page top row) ── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-text-color);
    font-family: 'Montserrat', sans-serif;
}

.page-subtitle {
    font-size: 14px;
    color: var(--navbar-text-color);
    margin-top: 3px;
    font-family: 'Roboto', sans-serif;
}

/* ── Responsive ── */

@media (max-width: 1300px) {
    .top-nav-right .nav-icon-btn:not(.always-show) {
        display: none;
    }
}

@media (max-width: 800px) {
    .tenant-name { font-size: 18px; }
}

/* ── Widget / card structure (matches client.agent-dna.com home.css) ── */

.box-gradient {
    background: linear-gradient(135deg, var(--tenant-colour-primary) 0%, var(--tenant-colour-secondary) 100%);
    height: 20px;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.dark-mode .box-gradient { opacity: 0.25; }

.widget-title {
    background: var(--tertiary-bg-color);
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-title h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-text-color);
    margin: 0;
    font-family: 'Montserrat', sans-serif;
}

.widget-content {
    padding: 20px;
    background: var(--secondary-bg-color);
}

.large-widget {
    width: 100%;
    border-radius: 15px;
    margin-bottom: 16px;
}

.small-widget {
    width: 100%;
    border-radius: 15px;
    margin-bottom: 16px;
}

.large-widget,
.small-widget {
    background: var(--secondary-bg-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.dark-mode .large-widget,
.dark-mode .small-widget {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.left-sm-widget-right-l-widget {
    display: flex;
    gap: 20px;
    width: 100%;
    margin-top: 24px;
}

/* ── Player / contact avatar (matches home.css .player-avatar) ── */
.contact-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--tenant-colour-primary) 0%, var(--tenant-colour-secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}
