/* main.css - CSS Consolidado do SysMath ERP+MES */

/* ==================== IMPORTS ==================== */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* ==================== VARIÁVEIS CSS ==================== */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --sidebar-width: 16rem;
    --sidebar-collapsed: 4rem;
    --header-height: 4rem;
    
    --z-sidebar: 1000;
    --z-header: 1001;
    --z-breadcrumbs: 1002;
    --z-modal: 1050;
    --z-dropdown: 1100;
}

/* ==================== RESET E BASE ==================== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    margin: 0;
    padding: 0;
}

/* ==================== LAYOUT PRINCIPAL ==================== */

/* Sidebar */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: var(--z-sidebar);
    transition: all 0.3s ease-in-out;
    overflow-x: visible;
    scroll-behavior: smooth;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Modo apenas ícones quando colapsada - Textos escondidos */
#sidebar.collapsed .sidebar-text {
    display: none !important;
}

#sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 0.375rem 0;
    margin: 0.0625rem 0;
}

#sidebar.collapsed .sidebar-item i {
    margin-right: 0;
    font-size: 1.25rem;
}

#sidebar.collapsed .sidebar-item:hover {
    background-color: var(--gray-100);
    border-radius: 0.5rem;
    margin: 0.0625rem 0.5rem;
}

/* Esconder botão X quando colapsada */
#sidebar.collapsed #sidebar-toggle-btn {
    display: none;
}

/* Ícone da indústria quando colapsada */
#sidebar.collapsed #industry-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 0 !important;
}


/* Otimizar espaçamento das listas quando colapsada */
#sidebar.collapsed ul {
    space-y: 0.125rem;
}

#sidebar.collapsed .space-y-2 > * + * {
    margin-top: 0.125rem;
}

/* Otimizar espaçamento dos títulos das seções quando colapsada */
#sidebar.collapsed .px-4 {
    padding: 0.25rem 0;
    margin: 0.125rem 0;
}

#sidebar.collapsed .mt-8 {
    margin-top: 0.25rem;
}

#sidebar.collapsed .mb-6 {
    margin-bottom: 0.125rem;
}

/* Otimizar espaçamento da navegação principal quando colapsada */
#sidebar.collapsed nav {
    padding: 0.25rem 0;
}

#sidebar.collapsed nav ul {
    padding: 0;
}

/* Reduzir altura do header quando colapsada */
#sidebar.collapsed .h-16 {
    height: 3rem;
    padding: 0.5rem 0;
    position: relative;
}

/* Corrigir container do ícone quando colapsada */
#sidebar.collapsed .flex.items-center.justify-between {
    justify-content: center !important;
    padding: 0 !important;
}


/* Tooltips para ícones quando colapsada - Sistema Simplificado */
#sidebar.collapsed .sidebar-item {
    position: relative;
}

/* Tooltip dinâmico - será posicionado via JavaScript */
.tooltip-dynamic {
    position: fixed;
    background: var(--gray-800);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: max-content;
}

/* Seta do tooltip */
.tooltip-dynamic::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--gray-800);
}

/* Mostrar tooltip */
.tooltip-dynamic.show {
    opacity: 1;
    visibility: visible;
}

/* ==================== ÍCONE DA INDÚSTRIA SIMPLIFICADO ==================== */

/* Ícone da indústria quando sidebar aberta */
#sidebar:not(.collapsed) #industry-icon {
    display: inline-block !important;
    margin-right: 0.75rem !important;
    margin-left: 0 !important;
    position: relative !important;
    z-index: 1001 !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    min-width: 1.5rem !important;
    min-height: 1.5rem !important;
    color: white !important;
    font-size: 1.5rem !important;
}

/* Tooltip removido para ícone da indústria */


#sidebar.hidden {
    transform: translateX(-100%);
}

/* Sidebar escondida */
#sidebar.hidden #industry-icon {
    display: none !important;
}

/* Main Content */
.main-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease-in-out;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
}

.main-content.sidebar-hidden {
    margin-left: 0;
}

/* Header */
header {
    position: relative;
    z-index: var(--z-header);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    height: var(--header-height);
}

/* Breadcrumbs */
#breadcrumbs-container {
    position: relative;
    z-index: var(--z-breadcrumbs);
}

/* ==================== RESPONSIVIDADE ==================== */

/* Desktop (lg+) */
@media (min-width: 1024px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
    
    .main-content.sidebar-collapsed {
        margin-left: var(--sidebar-collapsed);
    }
}

/* Mobile/Tablet */
@media (max-width: 1023px) {
    #sidebar {
        transform: translateX(-100%);
    }
    
    #sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.sidebar-collapsed {
        margin-left: 0;
    }
}

/* ==================== COMPONENTES ==================== */

/* Cards */
.card, .card-hover, .report-card, .status-card, .admin-card, .sales-card, .purchase-card, .hr-card, .quality-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
}

.card:hover, .card-hover:hover, .report-card:hover, .status-card:hover, .admin-card:hover, .sales-card:hover, .purchase-card:hover, .hr-card:hover, .quality-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Buttons */
.btn, .btn-primary, .btn-secondary, .btn-danger, .btn-outline, .modern-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s ease-in-out;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.2s ease-in-out;
}

.modal-close:hover {
    color: var(--gray-600);
}

/* ==================== ANIMAÇÕES ==================== */

/* Fade In */
.fade-in {
    animation: fadeInSmooth 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-content {
    animation: fadeInUpSmooth 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition {
    animation: fadeInUpSmooth 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInSmooth {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes fadeInUpSmooth {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loading {
    0% { opacity: 0; transform: translateY(20px); }
    50% { opacity: 0.5; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ==================== UTILITÁRIOS ==================== */

/* Sidebar Text */
.sidebar-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Sidebar Scroll - Ultra Discreto */
.sidebar-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.2) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 3px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.2);
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.4);
}

/* Scroll automático para sidebar */
#sidebar nav {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.2) transparent;
    scroll-behavior: smooth;
}

#sidebar nav::-webkit-scrollbar {
    width: 3px;
}

#sidebar nav::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar nav::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.2);
    border-radius: 3px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

#sidebar nav::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.4);
    opacity: 1;
}

/* Scroll fade effect - mais discreto */
#sidebar nav::-webkit-scrollbar-thumb:active {
    background-color: rgba(156, 163, 175, 0.6);
}

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Display Utilities */
.hidden { display: none !important; }
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }

/* Spacing Utilities */
.m-0 { margin: 0 !important; }
.m-1 { margin: 0.25rem !important; }
.m-2 { margin: 0.5rem !important; }
.m-3 { margin: 0.75rem !important; }
.m-4 { margin: 1rem !important; }
.m-5 { margin: 1.25rem !important; }
.m-6 { margin: 1.5rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }
.p-5 { padding: 1.25rem !important; }
.p-6 { padding: 1.5rem !important; }

/* Color Utilities */
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-gray-500 { color: var(--gray-500) !important; }
.text-gray-600 { color: var(--gray-600) !important; }
.text-gray-700 { color: var(--gray-700) !important; }
.text-gray-800 { color: var(--gray-800) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-secondary { background-color: var(--secondary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }
.bg-white { background-color: white !important; }
.bg-gray-50 { background-color: var(--gray-50) !important; }
.bg-gray-100 { background-color: var(--gray-100) !important; }
