/* DENPE Suite Styles */

/* Fix for SVG icons in navigation */
.denpe-nav-icon svg {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Ensure SVG icons are visible */
nav svg,
.nav-item svg,
button svg {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix layout issues */
.denpe-layout-fix {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Custom scrollbar */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Navigation Item Styles */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 500;
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: linear-gradient(to bottom, #60A5FA, #3B82F6);
    border-radius: 0 2px 2px 0;
}

/* Icon container */
.icon-container {
    transition: transform 0.2s ease;
}

.nav-item:hover .icon-container {
    transform: scale(1.1);
}

.nav-item.active .icon-container {
    color: white;
}

/* Collapsed state */
.nav-item-wrapper {
    position: relative;
}

.collapsed-item {
    width: 100%;
    justify-content: center;
    padding: 0.625rem;
}

.collapsed-item .icon-container {
    margin-right: 0;
}

/* Collapsed sidebar nav items */
.w-20 .nav-item {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.w-20 .nav-item-wrapper {
    position: relative;
}

/* Popover styles */
.nav-popover {
    position: absolute;
    left: 100%;
    margin-left: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #111827;
    color: white;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    z-index: 50;
    top: 50%;
    transform: translateY(-50%);
}

.nav-popover.show {
    opacity: 1;
    pointer-events: auto;
}

.nav-popover-submenu.show {
    opacity: 1;
    pointer-events: auto;
}

.nav-popover::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: rgb(17 24 39);
}

/* Submenu popover */
.nav-popover-submenu {
    position: absolute;
    left: 100%;
    margin-left: 0.5rem;
    padding: 0.75rem;
    background-color: #111827;
    color: white;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
    min-width: 200px;
    top: 0;
}

.nav-item-wrapper:hover .nav-popover-submenu {
    opacity: 0;
}

.nav-popover-submenu:hover {
    opacity: 1;
    pointer-events: auto;
}

.nav-popover-submenu a {
    color: rgba(255, 255, 255, 0.8);
}

.nav-popover-submenu a:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-popover-submenu::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 20px;
    border: 6px solid transparent;
    border-right-color: rgb(17 24 39);
}

/* Active state for collapsed items */
.collapsed-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    position: relative;
}

.collapsed-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: linear-gradient(to bottom, #60A5FA, #3B82F6);
    border-radius: 0 2px 2px 0;
}

/* Hover effects for wrapper */
.nav-item-wrapper {
    position: relative;
}

.nav-item-wrapper:hover {
    z-index: 60;
}

/* Active collapsed state improvements */
.w-20 .collapsed-item.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.w-20 .collapsed-item.active .icon-container {
    color: white;
    transform: scale(1.1);
}

/* Mobile menu animation */
@media (max-width: 1023px) {
    .sidebar-transition {
        transition: transform 0.3s ease-in-out;
    }
}

/* Fix for DENPE layout alignment */
.denpe-main-layout {
    display: flex;
    height: 100vh;
    background-color: #F7FAFE;
    position: relative;
}

.denpe-sidebar {
    background-color: #083D6C;
    color: white;
    flex-shrink: 0;
    position: fixed;
    height: 100%;
    z-index: 50;
    transition: all 0.3s ease;
}

/* Desktop: sidebar relativo */
@media (min-width: 1024px) {
    .denpe-sidebar {
        position: relative;
    }
    
    /* Asegurar que el main content no sea tapado por el sidebar */
    .denpe-sidebar.w-64 ~ .denpe-main-content {
        margin-left: 0; /* El flexbox maneja el espacio */
    }
    
    .denpe-sidebar.w-20 ~ .denpe-main-content {
        margin-left: 0; /* El flexbox maneja el espacio */
    }
}

/* Mobile: agregar margen cuando el sidebar está visible */
@media (max-width: 1023px) {
    .denpe-sidebar {
        left: 0;
        transform: translateX(-100%);
    }
    
    .denpe-sidebar.translate-x-0 {
        transform: translateX(0);
    }
    
    /* Asegurar que el main content use todo el ancho en móvil */
    .denpe-main-content {
        margin-left: 0 !important;
        width: 100%;
    }
}

.denpe-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: all 0.3s ease;
}

/* Fix for form inputs and buttons */
.denpe-input {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s ease;
}

.denpe-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.denpe-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.5rem;
    background-color: #3b82f6;
    color: white;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.denpe-button:hover {
    background-color: #2563eb;
}

.denpe-button svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
}

/* Card styles */
.denpe-card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.denpe-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.denpe-card-body {
    padding: 1.5rem;
}

/* Fix for overflow and scrolling */
.denpe-content-wrapper {
    flex: 1;
    overflow-y: auto;
    background-color: #F7FAFE;
}

/* Ensure proper z-index layering */
.denpe-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.denpe-header {
    background-color: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #EFEFEF;
    position: sticky;
    top: 0;
    z-index: 30;
}

/* Typography fixes */
.denpe-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}

.denpe-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Grid system fixes */
.denpe-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .denpe-grid-md-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Fix for icon rendering */
svg.denpe-icon {
    display: inline-block !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
    stroke: currentColor !important;
    fill: none !important;
    stroke-width: 2 !important;
}

/* Ensure Font Awesome icons work */
.fa, .fas, .far, .fal, .fad, .fab {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix for edit and delete buttons */
.denpe-action-button,
button[title="Editar"],
button[title="Eliminar"] {
    opacity: 1 !important;
    visibility: visible !important;
    cursor: pointer !important;
}

button[title="Editar"] i,
button[title="Eliminar"] i {
    display: inline-block !important;
    visibility: visible !important;
}