:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #f8961e;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --bg-color: #f5f7fa;
    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    background-color: #f0f2f5;
    color: var(--dark-color);
}

.erp-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: #ffffff;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #e0e0e0;
    transition: width 0.3s ease;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 70px;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    height: 70px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.logo-image {
    max-width: 160px;
    max-height: 40px;
    height: auto;
    transition: all 0.3s ease;
    object-fit: contain;
}

.sidebar.collapsed .logo-image {
    max-width: 35px;
    max-height: 35px;
}

/* Contenedor para el botón de toggle */
.sidebar-toggle-container {
    padding: 15px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    margin-top: auto;
}

/* Botón de toggle mejorado */
.sidebar-toggle {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    color: #666;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    width: 100%;
    max-width: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin: 0 auto;
}

.sidebar-toggle:hover {
    background: #e9ecef;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.sidebar.collapsed .sidebar-toggle {
    max-width: 40px;
    border-radius: 50%;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Main Menu Styles */
.main-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

.main-menu ul {
    list-style: none;
}

.main-menu li {
    margin: 0;
}

.main-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    white-space: nowrap;
    position: relative;
}

.main-menu a:hover {
    background: #f8f9fa;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.main-menu a.active,
.main-menu a.menu-consulta-ot.active,
.main-menu a.menu-consulta-vehiculos.active,
.main-menu a.menu-consulta-clientes.active {
    background: #e3f2fd;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
}

.main-menu a i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 1rem;
    color: #666;
    transition: margin-right 0.3s ease;
}

.sidebar.collapsed .main-menu a i {
    margin-right: 0;
}

.menu-text {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    visibility: hidden;
    position: absolute;
}

.menu-section {
    padding: 15px 20px 8px 20px;
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.sidebar.collapsed .menu-section {
    height: 20px;
    overflow: hidden;
    position: relative;
    margin: 10px 0;
    padding: 0;
}

.sidebar.collapsed .menu-section::after {
    content: "";
    display: block;
    width: 20px;
    height: 2px;
    background: #ccc;
    margin: 0 auto;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8f9fa;
    min-height: 100vh;
    overflow: hidden;
}

.top-bar {
    background: white;
    padding: 12px 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    height: 60px;
    flex-shrink: 0;
    border-bottom: 1px solid #e9ecef;
    justify-content: flex-end;
}

.mobile-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #2c3e50;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin-right: 15px;
}

.mobile-sidebar-toggle:hover {
    background: #ecf0f1;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
    font-weight: 500;
    margin-left: auto;
}

.user-info i {
    font-size: 1.5rem;
    color: #7f8c8d;
}

/* Module Container */
#module-container {
    flex: 1;
    min-height: 0;
    padding: 20px;
    background-color: #f5f7fa;
    overflow: hidden;
    height: calc(100vh - 60px);
}

#module-frame {
    width: 100%;
    height: calc(100vh - 100px);
    border: none;
    display: block;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Common Module Styles */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.module-title {
    font-size: 24px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}

/* Scrollbar */
#module-container::-webkit-scrollbar {
    width: 8px;
}

#module-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#module-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#module-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .logo-image {
        max-width: 60px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        height: 100vh;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .mobile-sidebar-toggle {
        display: block;
    }
    
    .sidebar-toggle-container {
        display: none;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .logo-image {
        max-width: 150px;
    }
    
    .sidebar.collapsed .logo-image {
        max-width: 35px;
    }
    
    /* Ajuste de altura en móviles */
    #module-container {
        height: calc(100vh - 60px);
        padding: 15px;
    }
}