/* 
 * DWPortal Custom CSS - Sistema de Seguimiento de Documentos Laborales
 * Tema verde: #03AC13
 */

:root {
    --primary: #03AC13;
    --primary-dark: #028E10;
    --primary-light: #4BDE59;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --sidebar-bg: #0f1b2d;      /* Navy oscuro, igual a la referencia */
    --sidebar-bg-alt: #142338;
    --sidebar-header-bg: #0f1b2d;
    --content-bg: #f4f6f9;
    --card-bg: #ffffff;
}

/* Dark mode overrides (toggled via data-bs-theme="dark" on <html>) */
[data-bs-theme="dark"] {
    --content-bg: #10131a;
    --card-bg: #1a1f2b;
}
[data-bs-theme="dark"] body { background-color: var(--content-bg); color: #e4e6eb; }
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .navbar.bg-light,
[data-bs-theme="dark"] .footer.bg-light { background-color: var(--card-bg) !important; color: #e4e6eb; }
[data-bs-theme="dark"] .table { color: #e4e6eb; }
[data-bs-theme="dark"] .text-muted { color: #9aa3b2 !important; }

/* Layout & General Styles */
body {
    background-color: var(--content-bg);
    color: #333333;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
}

#content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

#content.expanded {
    width: calc(100% - var(--sidebar-collapsed-width));
}

.content-wrapper {
    flex: 1 0 auto;
    padding-bottom: 60px; /* Ensures footer doesn't overlap content */
}

.footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* Sidebar Styles */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    transition: all 0.3s;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
}

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

#sidebar .sidebar-header {
    padding: 18px 20px;
    background-color: var(--sidebar-header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

#sidebar .sidebar-header a {
    color: white;
    text-decoration: none;
    font-weight: 600;
}

#sidebar .sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

#sidebar .sidebar-brand-text .brand-main {
    font-size: 1.05rem;
    font-weight: 700;
}

#sidebar .sidebar-brand-text .brand-main span {
    color: var(--primary-light);
}

#sidebar .sidebar-brand-text .brand-sub {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #8b96ab;
    font-weight: 500;
}

#sidebar.collapsed .sidebar-brand-text {
    display: none;
}

#sidebar .sidebar-header a i {
    margin-right: 10px;
    transition: all 0.3s;
    cursor: pointer;
}

#sidebar-toggle-icon {
    transition: transform 0.3s;
}

#sidebar.collapsed .sidebar-header a span {
    display: none;
}

#sidebar.collapsed .sidebar-header a i {
    margin-right: 0;
    font-size: 1.5rem;
    transform: rotate(180deg);
}

#sidebar ul.components {
    padding: 20px 0;
    flex-grow: 1;
    overflow-y: auto;
}

#sidebar ul li a {
    padding: 10px 20px;
    font-size: 1.1em;
    display: block;
    color: #adb5bd;
    text-decoration: none;
    transition: all 0.3s;
}

#sidebar ul li a:hover,
#sidebar ul li a.active {
    color: #fff;
    background: rgba(3, 172, 19, 0.15);
    border-left: 4px solid var(--primary);
}

#sidebar ul li a i {
    margin-right: 10px;
    min-width: 20px;
    text-align: center;
}

#sidebar.collapsed ul li a span {
    display: none;
}

#sidebar.collapsed ul li a {
    padding: 15px;
    text-align: center;
}

#sidebar.collapsed ul li a i {
    margin-right: 0;
    font-size: 1.2rem;
}

/* Submenu styles */
#sidebar .dropdown-toggle::after {
    display: block;
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

#sidebar.collapsed .dropdown-toggle::after {
    display: none;
}

#sidebar ul ul a {
    font-size: 0.9em !important;
    padding-left: 50px !important;
    background: rgba(0, 0, 0, 0.2);
}

#sidebar .sidebar-footer ul ul a {
    padding-left: 50px !important;
    background: rgba(0, 0, 0, 0.3);
    font-size: 0.85em !important;
    color: #ddd;
    display: flex;
    align-items: center;
}

#sidebar .sidebar-footer ul ul a i {
    margin-right: 10px;
    min-width: 20px;
    text-align: center;
}

#sidebar .sidebar-footer ul ul a:hover {
    background: rgba(3, 172, 19, 0.15);
}

#sidebar.collapsed .sidebar-footer .dropdown-toggle::after {
    display: none;
}

#sidebar.collapsed ul ul,
#sidebar.collapsed .sidebar-footer ul ul {
    display: none !important;
}

/* Profile styles */
.profile-menu-item {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.profile-link {
    display: flex !important;
    align-items: center;
    padding: 10px 15px !important;
}

.profile-image-container {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    border: 2px solid var(--primary);
}

/* Top bar (utility strip) */
.top-utility-bar {
    background-color: var(--card-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.top-utility-bar .company-select {
    max-width: 220px;
}

.top-utility-bar .icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    position: relative;
    transition: background 0.2s;
}

.top-utility-bar .icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.top-utility-bar .notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 8px;
    background: #dc3545;
    color: #fff;
    font-size: 0.62rem;
    line-height: 16px;
    text-align: center;
}

.top-utility-bar .user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 10px;
}

.top-utility-bar .user-chip:hover {
    background: rgba(0, 0, 0, 0.05);
}

.top-utility-bar .user-avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.username {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.profile-text {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Sidebar footer with profile */
.sidebar-footer {
    margin-top: auto;
    padding-bottom: 20px;
}

.sidebar-footer hr {
    margin: 15px 0 10px 0;
    border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-footer ul.components {
    padding: 0;
}

#sidebar.collapsed .sidebar-footer ul li a {
    padding: 15px;
    text-align: center;
    justify-content: center;
}

#sidebar.collapsed .profile-image-container {
    margin-right: 0;
}

#sidebar.collapsed .profile-info {
    display: none;
}

/* Card Styles */
.card {
    background-color: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.card-header {
    background-color: rgba(3, 172, 19, 0.05);
    border-bottom: 1px solid rgba(3, 172, 19, 0.1);
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Card borders */
.border-left-primary {
    border-left: 4px solid var(--primary) !important;
}

.border-left-success {
    border-left: 4px solid #28a745 !important;
}

.border-left-info {
    border-left: 4px solid #17a2b8 !important;
}

.border-left-warning {
    border-left: 4px solid #ffc107 !important;
}

.border-left-danger {
    border-left: 4px solid #dc3545 !important;
}

/* Button Styles */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: transparent;
    overflow: hidden;
    z-index: 9999;
}

.loading-indicator::before {
    content: "";
    position: absolute;
    height: 100%;
    width: 30%;
    background-color: var(--primary);
    animation: loading 1.5s infinite ease-in-out;
}

@keyframes loading {
    0% {
        left: -30%;
    }
    100% {
        left: 100%;
    }
}

/* Table Styles */
.table {
    color: #333333;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(3, 172, 19, 0.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(3, 172, 19, 0.1);
    color: #333333;
}

/* Status Colors */
.text-success {
    color: #28a745 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-info {
    color: #17a2b8 !important;
}

.text-primary {
    color: var(--primary) !important;
}

/* Mobile Overlay */
.overlay {
    display: none;
    position: fixed;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 998;
    opacity: 0;
    transition: all 0.5s ease-in-out;
}

.overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile styles */
@media (max-width: 768px) {
    #sidebar {
        margin-left: -250px;
        position: fixed;
        z-index: 999;
        height: 100%;
    }
    
    #sidebar.active {
        margin-left: 0;
    }
    
    #content {
        width: 100%;
    }
    
    #content.expanded {
        width: 100%;
    }
    
    #sidebarCollapse {
        display: block;
    }
    
    .user-mobile-profile {
        display: flex !important;
    }
}

/* Toast notification */
.toast {
    background-color: var(--card-bg);
    color: #333333;
}

.toast-header {
    background-color: rgba(3, 172, 19, 0.05);
    color: #333333;
    border-bottom: 1px solid rgba(3, 172, 19, 0.1);
}

/* Form Styles */
.form-control {
    background-color: #ffffff;
    border: 1px solid #ced4da;
    color: #333333;
}

.form-control:focus {
    background-color: #ffffff;
    color: #333333;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(3, 172, 19, 0.25);
}

.input-group-text {
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    color: #333333;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Profile specific styles */
.profile-avatar-placeholder {
    background-color: var(--primary);
    color: white;
    font-size: 48px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.mobile-profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mobile-profile-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =====================================================
   REDISEÑO UI OPERATIVO – Estilos globales adicionales
   ===================================================== */

/* Cards mejoradas */
.card {
    border-radius: 0.75rem !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07) !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
}

/* KPI Cards */
.kpi-card {
    border-radius: 0.75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.kpi-icon.bg-success-soft { background: rgba(40,167,69,0.12); color: #28a745; }
.kpi-icon.bg-primary-soft { background: rgba(3,172,19,0.12); color: #03AC13; }
.kpi-icon.bg-info-soft    { background: rgba(23,162,184,0.12); color: #17a2b8; }
.kpi-icon.bg-warning-soft { background: rgba(255,193,7,0.12); color: #e0a800; }
.kpi-icon.bg-danger-soft  { background: rgba(220,53,69,0.12); color: #dc3545; }
.kpi-icon.bg-secondary-soft { background: rgba(108,117,125,0.12); color: #6c757d; }
.kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #6c757d; }
.kpi-sub { font-size: 0.75rem; color: #6c757d; margin-top: 2px; }

/* Tabla compacta estándar */
.table-ops {
    font-size: 0.875rem;
}
.table-ops thead th {
    background: rgba(3,172,19,0.05);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #495057;
    border-bottom: 2px solid rgba(3,172,19,0.15);
    white-space: nowrap;
}
.table-ops tbody tr { cursor: pointer; }
.table-ops tbody tr:hover { background: rgba(3,172,19,0.05); }

/* Badges de estado de sincronización */
.badge-status-pending   { background: #ffc107; color: #212529; }
.badge-status-downloaded{ background: #17a2b8; color: #fff; }
.badge-status-uploaded  { background: #28a745; color: #fff; }
.badge-status-duplicate { background: #6c757d; color: #fff; }
.badge-status-error     { background: #dc3545; color: #fff; }
/* cumplimiento */
.badge-cumple           { background: #28a745; color: #fff; }
.badge-falta            { background: #dc3545; color: #fff; }
.badge-pendiente        { background: #ffc107; color: #212529; }
.badge-error_de_carga   { background: #fd7e14; color: #fff; }

/* Empty state */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: #adb5bd;
}
.empty-state i { font-size: 3rem; display: block; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; margin: 0; }

/* Toast container global */
#toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 11000;
    min-width: 300px;
    max-width: 420px;
}

/* Botones con spinner */
.btn .spinner-border-sm { vertical-align: middle; }

/* Sección de estado de sync */
.sync-status-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: rgba(3,172,19,0.04);
    border-radius: 0.5rem;
    border: 1px solid rgba(3,172,19,0.1);
}
.sync-dot {
    width: 10px; height: 10px; border-radius: 50%;
    display: inline-block; flex-shrink: 0;
}
.sync-dot.running { background: #ffc107; animation: pulse 1s infinite; }
.sync-dot.idle    { background: #28a745; }
.sync-dot.unknown { background: #adb5bd; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* Row clickable */
.row-clickable { cursor: pointer; }
.row-clickable:hover td { background: rgba(3,172,19,0.05) !important; }

/* Tabs operativos */
.nav-tabs-ops .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6c757d;
    border-radius: 0.5rem 0.5rem 0 0;
}
.nav-tabs-ops .nav-link.active {
    color: #03AC13;
    border-bottom-color: #fff;
    font-weight: 600;
}

/* Accordion documentos */
.accordion-ops .accordion-button {
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(3,172,19,0.04);
}
.accordion-ops .accordion-button:not(.collapsed) {
    color: #03AC13;
    background: rgba(3,172,19,0.08);
    box-shadow: none;
}

/* Barra de progreso de cumplimiento */
.compliance-bar .progress { height: 8px; border-radius: 4px; }

/* Chip de filtro activo */
.filter-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: rgba(3,172,19,0.1); color: #028E10;
    border-radius: 1rem; padding: 0.2rem 0.7rem;
    font-size: 0.78rem; font-weight: 500;
}

/* SPA Navigation - Page transitions */
.page-transition-enter {
    opacity: 0;
    transform: translateY(10px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 300ms, transform 300ms;
}

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 300ms, transform 300ms;
}