/**
 * LEXPROJECT MAIN/* === LEXPROJECT CSS BUNDLER V4 === */
/* All variables and tokens */
@import url('tokens.css?v=4.2');

/* Components */
@import url('buttons.css?v=4.2');
@import url('forms.css?v=4.2');
@import url('modals.css?v=4.2');
@import url('utilities.css?v=4.2');


/* Core Layout Overrides for Light Mode */
html.light-mode .top-bar {
    background: rgba(255, 255, 255, 0.85);
}
html.light-mode input[type="date"],
html.light-mode input[type="time"],
html.light-mode input[type="datetime-local"] {
    color-scheme: light;
}

/* Kanban Overrides for Light Mode (hardcoded CRM alpha colors) */
html.light-mode .kanban-column {
    background: rgba(0, 0, 0, 0.02) !important;
}
html.light-mode .column-header {
    border-bottom: 2px solid rgba(0, 0, 0, 0.05) !important;
}
html.light-mode .card-count {
    background: rgba(0, 0, 0, 0.05) !important;
}

/* iOS Theme Switcher Style */
.theme-switch {
    display: inline-block;
    position: relative;
    width: 64px;
    height: 32px;
    margin: 0;
}
.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 32px;
    background-color: var(--card-bg);
    border: 1px solid var(--glass-border);
    transition: cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.15);
}
html.light-mode .theme-slider {
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.05);
    background-color: #E2E8F0;
}
.theme-slider .icon-sun, .theme-slider .icon-moon {
    font-size: 14px;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.3s;
}
/* Bolinha do toggle */
.theme-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 3px;
    bottom: 2px;
    background-color: #FFFFFF;
    border-radius: 50%;
    transition: transform cubic-bezier(0.4, 0, 0.2, 1) 0.3s, background-color 0.3s;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .theme-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}
input:checked + .theme-slider:before {
    transform: translateX(30px);
    background-color: #FFFFFF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    /* Scroll handled in main-content */
    height: 100vh;
}

h1,
h2,
h3,
.logo-text,
.header-info h1 {
    font-family: var(--font-heading);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    z-index: 100;
    overflow-y: auto;
    /* Permitir scroll se houver muitos itens */
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar-header {
    padding: 0 24px 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    background: none;
    -webkit-text-fill-color: initial;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.nav-category {
    padding: 24px 24px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.nav-item .icon {
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent 40%),
        radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.02), transparent 40%);
}

.top-bar {
    height: var(--topbar-height);
    background: rgba(14, 34, 56, 0.8);
    /* Matches sidebar-bg/bg-dark roughly */
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 90;
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
}

/* Input Styles - Number & Date */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="date"] {
    color-scheme: dark;
}

/* Module Layouts */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    /* Margem de respiro generosa */
    gap: 24px;
}

.header-info h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header-info p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
}

.header-actions {
    display: flex;
    gap: 16px;
    /* Espaçamento orgânico solicitado */
    align-items: center;
    flex-wrap: wrap;
}

/* Side Drawer (Global Detail Panel) */
.side-drawer {
    position: fixed;
    top: 0;
    right: -450px;
    /* Escondido por padrão */
    width: 450px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--glass-border);
    box-shadow: none;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    backdrop-filter: blur(20px);
}

.side-drawer.active {
    right: 0;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}
html.light-mode .side-drawer.active {
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.drawer-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed var(--glass-border);
    border-radius: 24px;
    margin: 20px 0;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-secondary);
    max-width: 400px;
    margin-bottom: 32px;
    line-height: 1.6;
}

.header-info h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    font-family: var(--font-heading);
}

.header-info p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.workspace-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.workspace-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

.ws-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.ws-label {
    color: var(--text-secondary);
}

.ws-name {
    font-weight: 600;
    color: var(--text-primary);
}

.ws-role {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 700;
}

.ws-dropdown-trigger {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Workspace Dropdown */
.workspace-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: 280px;
    background: var(--sidebar-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

.workspace-dropdown.active {
    display: flex;
}

.dropdown-header {
    padding: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
}

.workspace-list {
    max-height: 300px;
    overflow-y: auto;
}

.ws-item {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.ws-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ws-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent);
}

.ws-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.ws-item-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-bar {
    flex: 0 0 400px;
}

.search-bar input {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.top-bar-actions {
    display: flex;
    gap: 16px;
}

.card-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--glass-hover);
    transform: translateY(-2px);
}

.module-view {
    padding: 40px;
    min-height: calc(100vh - var(--topbar-height));
}

/* Global Buttons */
button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--accent);
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--accent);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 4px 8px;
    transition: var(--transition);
}

.btn-text:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
}

.filter-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Scrollbar for modern feel */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 80px;
    }

    .logo-text,
    .user-info,
    .nav-item span:not(.icon) {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .sidebar-header,
    .sidebar-footer {
        padding: 24px 12px;
        display: flex;
        justify-content: center;
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        display: none;
    }

    .app-container {
        flex-direction: column;
    }

    .top-bar {
        padding: 0 20px;
        height: 60px;
    }

    .search-bar {
        display: none;
        /* Oculta busca volumosa em mobile */
    }

    .module-view {
        padding: 20px;
        padding-bottom: 90px;
        /* Espaço para o bottom nav */
    }

    .header-info h1 {
        font-size: 1.6rem;
    }

    /* Bottom Navigation Bar */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: var(--sidebar-bg);
        border-top: 1px solid var(--glass-border);
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
        z-index: 1000;
        backdrop-filter: blur(20px);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--text-secondary);
        font-size: 0.7rem;
        text-decoration: none;
        padding: 8px;
        transition: var(--transition);
        background: transparent;
        border: none;
        cursor: pointer;
    }

    .mobile-nav-item .icon {
        font-size: 1.4rem;
    }

    .mobile-nav-item.active {
        color: var(--accent);
    }

    /* Ajuste de Modais Universais */
    .side-drawer {
        width: 100%;
        right: -100%;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .btn-primary,
    .btn-secondary {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* Fallback para Desktop ocultar Mobile Nav */
@media (min-width: 1025px) {
    .mobile-nav {
        display: none;
    }
}