/**
 * BioData Environmental Intelligence Design System
 * Componentes visuais para sistemas que conectam dados, pessoas e biodiversidade
 * Referência: Design System BioData Oficial
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
    /* 1. PALETA PRIMÁRIA */
    --color-forest: #0F5132;
    --color-forest-hover: #15803D;
    --color-forest-dark: #064E3B;
    --color-forest-darker: #022C22;
    --color-natural: #16A34A;
    --color-natural-light: #F0FDF4;
    --color-natural-subtle: rgba(22, 163, 74, 0.12);
    --color-water: #0EA5E9;
    --color-water-light: #F0F9FF;
    --color-earth: #B45309;
    --color-earth-light: #FEF3C7;

    /* 2. PALETA NEUTRA */
    --color-graphite: #111827;
    --color-dark-gray: #374151;
    --color-gray: #6B7280;
    --color-gray-light: #9CA3AF;
    --color-border: #E5E7EB;
    --color-bg-subtle: #F9FAFB;
    --color-white: #FFFFFF;

    /* 3. PALETA APOIO / STATUS */
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    --color-info: #3B82F6;
    --color-ai: #8B5CF6;

    /* 4. TIPOGRAFIA */
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* 5. FORMAS E ESPAÇAMENTOS */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* 6. SOMBRAS E PROFUNDIDADE */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 81, 50, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 2px 12px -2px rgba(15, 81, 50, 0.06), 0 1px 3px rgba(0, 0, 0, 0.03);

    /* 7. TRANSIÇÃO SUAVE */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: var(--font-family) !important;
    color: var(--color-dark-gray);
    background-color: #F8FAFC;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   LAYOUT GERAL: SIDEBAR RETRÁTIL & TOPBAR
   ========================================================================== */

#appSidebar {
    transition: width var(--transition-normal);
    background: linear-gradient(180deg, var(--color-forest-dark) 0%, var(--color-forest-darker) 100%);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    width: 256px;
}

#appSidebar.collapsed {
    width: 76px !important;
}

#appSidebar.collapsed .sidebar-text,
#appSidebar.collapsed .sidebar-section-header,
#appSidebar.collapsed .sidebar-footer-text,
#appSidebar.collapsed .sidebar-badge {
    display: none !important;
}

#appSidebar.collapsed .sidebar-item {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#appSidebar.collapsed .sidebar-header-box {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Tooltip no estado recolhido */
#appSidebar.collapsed .sidebar-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 82px;
    background: var(--color-graphite);
    color: var(--color-white);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 100;
    box-shadow: var(--shadow-md);
    pointer-events: none;
    animation: fadeInTooltip 0.15s ease-out;
}

@keyframes fadeInTooltip {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}

.sidebar-item {
    position: relative;
    border-radius: var(--radius-sm);
    margin: 2px 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #D1D5DB;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: none;
    background: transparent;
    text-align: left;
    width: calc(100% - 20px);
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
}

.sidebar-item.active {
    background-color: var(--color-natural-subtle) !important;
    color: #FFFFFF !important;
    font-weight: 600;
    border-left: 3px solid var(--color-natural);
    box-shadow: inset 0 0 16px rgba(22, 163, 74, 0.1);
}

.sidebar-item.active svg,
.sidebar-item.active i {
    color: var(--color-natural) !important;
}

/* ==========================================================================
   TOPBAR TRANSLÚCIDA (GLASSMORPHISM)
   ========================================================================== */

.topbar-glass {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

/* ==========================================================================
   BOTÕES MODERNOS
   ========================================================================== */

.btn-primary {
    background-color: var(--color-forest);
    color: var(--color-white);
    font-weight: 600;
    font-size: 13px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 6px rgba(15, 81, 50, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary:hover {
    background-color: var(--color-forest-hover);
    box-shadow: 0 4px 12px rgba(15, 81, 50, 0.28);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: var(--color-white);
    color: var(--color-dark-gray);
    border: 1.5px solid var(--color-border);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: var(--color-bg-subtle);
    border-color: #D1D5DB;
    color: var(--color-graphite);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-ghost {
    background: transparent;
    color: var(--color-gray);
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-ghost:hover {
    background-color: var(--color-bg-subtle);
    color: var(--color-graphite);
}

/* ==========================================================================
   CARDS MODERNOS & CONTAINERES SAAS
   ========================================================================== */

.card-saas {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 22px;
    transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card-saas:hover {
    border-color: #D1D5DB;
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   CHIPS SELECIONÁVEIS (SUBSTITUI CHECKBOXES ANTIGOS)
   ========================================================================== */

.chip-selectable {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--color-border);
    background-color: var(--color-white);
    color: var(--color-dark-gray);
    transition: all var(--transition-fast);
    user-select: none;
}

.chip-selectable:hover {
    border-color: var(--color-natural);
    background-color: var(--color-natural-light);
    color: var(--color-forest-dark);
}

.chip-selectable.selected {
    border-color: var(--color-natural) !important;
    background-color: var(--color-natural-light) !important;
    color: var(--color-forest-dark) !important;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.18);
}

.chip-selectable .chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: #E5E7EB;
    color: #6B7280;
    transition: all var(--transition-fast);
    font-size: 11px;
}

.chip-selectable.selected .chip-icon {
    background: var(--color-natural);
    color: #FFFFFF;
}

/* ==========================================================================
   TAGS / PILLS DE COLUNAS REMOVÍVEIS
   ========================================================================== */

.tag-removable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background-color: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-dark-gray);
    transition: all var(--transition-fast);
}

.tag-removable:hover {
    border-color: #D1D5DB;
    background-color: #E5E7EB;
}

.tag-removable.tag-dim {
    background-color: var(--color-natural-light);
    border-color: #BBF7D0;
    color: var(--color-forest-dark);
}

.tag-removable.tag-fato {
    background-color: var(--color-water-light);
    border-color: #BAE6FD;
    color: #0369A1;
}

.tag-remove-btn {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    padding: 2px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
}

.tag-remove-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   DROPZONE MODERNA (ARRASTAR & SOLTAR PLANILHA)
   ========================================================================== */

.dropzone-modern {
    border: 2px dashed #CBD5E1;
    border-radius: var(--radius-lg);
    padding: 36px 24px;
    text-align: center;
    background-color: #F8FAFC;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.dropzone-modern:hover,
.dropzone-modern.dragover {
    border-color: var(--color-natural);
    background-color: var(--color-natural-light);
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.08);
}

/* ==========================================================================
   STEPPER GUIA VISUAL DE ETAPAS
   ========================================================================== */

.stepper-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    gap: 16px;
    overflow-x: auto;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-gray-light);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.step-item.active {
    color: var(--color-forest-dark);
    font-weight: 700;
}

.step-item.completed {
    color: var(--color-natural);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 1.5px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-gray-light);
}

.step-item.active .step-number {
    background: var(--color-forest);
    color: var(--color-white);
    border-color: var(--color-forest);
    box-shadow: 0 2px 6px rgba(15, 81, 50, 0.25);
}

.step-item.completed .step-number {
    background: var(--color-natural);
    color: var(--color-white);
    border-color: var(--color-natural);
}

.step-divider {
    flex: 1;
    height: 2px;
    background: #E5E7EB;
    border-radius: 1px;
    min-width: 24px;
}

/* ==========================================================================
   SISTEMA DE TOASTS FLUTUANTES (FEEDBACK ELEGANTE)
   ========================================================================== */

#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-message {
    pointer-events: auto;
    background: var(--color-graphite);
    color: var(--color-white);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    animation: slideUpToast 0.25s ease-out;
    border-left: 4px solid var(--color-natural);
}

.toast-message.toast-success { border-left-color: var(--color-success); }
.toast-message.toast-error { border-left-color: var(--color-danger); }
.toast-message.toast-warning { border-left-color: var(--color-warning); }
.toast-message.toast-info { border-left-color: var(--color-water); }

@keyframes slideUpToast {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   TABELAS MODERNAS SAAS
   ========================================================================== */

.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.table-modern thead th {
    background-color: #F8FAFC;
    color: #4B5563;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-modern tbody tr {
    transition: background-color var(--transition-fast);
}

.table-modern tbody tr:hover {
    background-color: #F0FDF4;
}

.table-modern tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #F1F5F9;
    color: var(--color-dark-gray);
}

/* ==========================================================================
   SEARCHABLE DROPDOWN / AUTOCOMPLETE PICKER
   ========================================================================== */

.search-picker-menu {
    max-height: 220px;
    overflow-y: auto;
    background: #FFFFFF;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    z-index: 50;
    scrollbar-width: thin;
}

.search-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    font-size: 12px;
    color: var(--color-text-main);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    border-bottom: 1px solid #F8FAFC;
}

.search-picker-item:last-child {
    border-bottom: none;
}

.search-picker-item:hover,
.search-picker-item.highlighted {
    background-color: var(--color-natural-subtle);
    color: var(--color-forest-dark);
    font-weight: 600;
}

.search-picker-item .badge-add {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-natural);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.search-picker-item:hover .badge-add,
.search-picker-item.highlighted .badge-add {
    opacity: 1;
}

.search-picker-item-blue:hover,
.search-picker-item-blue.highlighted {
    background-color: var(--color-water-subtle);
    color: #0369A1;
    font-weight: 600;
}

.search-picker-item-blue .badge-add {
    color: var(--color-water);
}



/* ==========================================================================
   MOBILE RESPONSIVENESS & OFF-CANVAS SIDEBAR (BioData Design System)
   ========================================================================== */

.btn-hamburger-mobile {
    display: none;
    background: transparent;
    border: 1px solid rgba(15, 81, 50, 0.2);
    color: var(--color-forest-dark);
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.btn-hamburger-mobile:hover {
    background: rgba(15, 81, 50, 0.08);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
    display: block !important;
    opacity: 1 !important;
}

@media (max-width: 768px) {
    #appSidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 280px !important;
        max-width: 82vw !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 9999 !important;
        box-shadow: none !important;
    }

    #appSidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45) !important;
    }

    #appSidebar.mobile-open .sidebar-text,
    #appSidebar.mobile-open .sidebar-section-header,
    #appSidebar.mobile-open .sidebar-footer-text,
    #appSidebar.mobile-open .sidebar-badge {
        display: inline !important;
    }

    .btn-hamburger-mobile {
        display: inline-flex !important;
    }

    .topbar-glass {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
}
