/* K2 Hub CRM — Base Styles (Reset, Typography, Layout) */

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

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--k2-font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--k2-text);
    background-color: var(--k2-bg-secondary);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--k2-blue);
    text-decoration: none;
    transition: var(--k2-transition);
}
a:hover {
    color: var(--k2-orange);
}

img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--k2-text);
}
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

/* ========================
   APP LAYOUT
   ======================== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--k2-surface);
    border-right: 1px solid var(--k2-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--k2-transition-slow);
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--k2-border);
    flex-shrink: 0;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--k2-blue), var(--k2-blue-light));
    border-radius: var(--k2-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--k2-text);
}
.sidebar-logo .logo-text span {
    color: var(--k2-blue);
}
.sidebar-logo .logo-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--k2-orange);
    margin-left: 6px;
    padding: 2px 6px;
    background: var(--k2-orange-50);
    border-radius: var(--k2-radius-full);
}

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

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

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--k2-text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--k2-radius);
    color: var(--k2-text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--k2-transition);
    margin-bottom: 2px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

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

.nav-item.active {
    background: var(--k2-blue-50);
    color: var(--k2-blue);
    font-weight: 600;
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-item .nav-icon svg, .nav-item .nav-icon i {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
    color: var(--k2-text-secondary);
    transition: var(--k2-transition);
}
.nav-item.active .nav-icon svg, .nav-item.active .nav-icon i {
    color: var(--k2-blue);
}

.nav-item .nav-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--k2-radius-full);
    background: var(--k2-error-bg);
    color: var(--k2-error);
}

.sidebar-user .btn-ghost {
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-user .btn-ghost svg, .sidebar-user .btn-ghost i {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
    color: var(--k2-text-secondary);
}
.sidebar-user .btn-ghost:hover svg, .sidebar-user .btn-ghost:hover i {
    color: var(--k2-text);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--k2-border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: var(--k2-radius);
    transition: var(--k2-transition);
}
.sidebar-user:hover {
    background: var(--k2-bg-secondary);
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--k2-radius-full);
    background: linear-gradient(135deg, var(--k2-blue), var(--k2-orange));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    margin-right: 10px;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--k2-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user .user-role {
    font-size: 11px;
    color: var(--k2-text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.main-header {
    height: var(--header-height);
    background: var(--k2-surface);
    border-bottom: 1px solid var(--k2-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--k2-text);
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Page Content */
.page-content {
    padding: 24px;
    max-width: 1400px;
}

/* ========================
   SCROLLBAR
   ======================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--k2-border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--k2-text-muted);
}

/* ========================
   UTILITIES
   ======================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--k2-text-muted); }
.text-success { color: var(--k2-success); }
.text-error { color: var(--k2-error); }
.text-warning { color: var(--k2-warning); }
.text-blue { color: var(--k2-blue); }
.text-orange { color: var(--k2-orange); }

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }

.hidden { display: none !important; }

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--k2-shadow-xl);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-toggle {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 16px;
    }
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }
}

/* Mobile menu toggle (hidden on desktop) */
.mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--k2-text);
    font-size: 20px;
    border-radius: var(--k2-radius-sm);
    margin-right: 12px;
}
.mobile-toggle:hover {
    background: var(--k2-bg-secondary);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}
.sidebar-overlay.visible {
    display: block;
}
