/* ==========================================================================
   ListoGO Suite - Full-Width Modern Dashboard CSS
   ========================================================================== */

/* Break out of standard WordPress theme content constraints */
html:has(.listogo-app-layout),
html.admin-bar:has(.listogo-app-layout),
body:has(.listogo-app-layout),
body.admin-bar:has(.listogo-app-layout),
.listogo-canvas-fullscreen {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body:has(.listogo-app-layout) #wpadminbar,
.listogo-canvas-fullscreen #wpadminbar {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    visibility: hidden !important;
}

.page:has(.listogo-app-layout),
body:has(.listogo-app-layout) {
    background-color: #f1f5f9 !important;
}

body.page:has(.listogo-app-layout) .entry-header,
body.page:has(.listogo-app-layout) .entry-title,
body.page:has(.listogo-app-layout) .wp-block-post-title,
body.page:has(.listogo-app-layout) h1.post-title,
body.page:has(.listogo-app-layout) .page-header {
    display: none !important;
}

body.page:has(.listogo-app-layout) .wp-site-blocks,
body.page:has(.listogo-app-layout) .site-content,
body.page:has(.listogo-app-layout) .entry-content,
body.page:has(.listogo-app-layout) .wp-block-post-content,
body.page:has(.listogo-app-layout) .post-content,
body.page:has(.listogo-app-layout) #content,
body.page:has(.listogo-app-layout) main.site-main {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Base App Layout */
.listogo-app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    background: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #1e293b;
    box-sizing: border-box;
    position: relative;
    margin: 0 !important;
}

.listogo-app-layout * {
    box-sizing: border-box;
}

/* Sidebar Styling */
.listogo-sidebar {
    width: 270px;
    min-width: 270px;
    background: #0b1329;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.listogo-sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
}

.listogo-logo-badge {
    background: linear-gradient(135deg, #fd5100 0%, #ff7332 100%);
    color: #ffffff;
    font-weight: 900;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(253, 81, 0, 0.35);
    letter-spacing: -0.5px;
}

.listogo-logo-text {
    color: #ffffff;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.3px;
}

.listogo-logo-sub {
    font-size: 0.72rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.listogo-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.listogo-sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.listogo-sidebar-nav::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 10px;
}

.listogo-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    margin-bottom: 4px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.listogo-nav-item:hover {
    background: #1e293b;
    color: #ffffff;
    transform: translateX(3px);
}

.listogo-nav-item.active {
    background: linear-gradient(135deg, #fd5100 0%, #e04700 100%);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(253, 81, 0, 0.3);
}

.listogo-nav-item .nav-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
}

.listogo-sidebar-footer {
    padding: 18px 20px;
    border-top: 1px solid #1e293b;
    background: #080e1e;
}

/* Main Content Area */
.listogo-main-content {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    background: #f8fafc;
    min-width: 0;
}

/* Top Dashboard Bar */
.listogo-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.listogo-page-title {
    font-size: 1.75rem;
    color: #0f172a;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.listogo-page-desc {
    color: #64748b;
    font-size: 0.92rem;
    margin-top: 4px;
}

/* KPI Cards Grid */
.listogo-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.listogo-kpi-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.listogo-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.listogo-kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
}

.listogo-kpi-card.kpi-orange::before { background: #fd5100; }
.listogo-kpi-card.kpi-green::before { background: #10b981; }
.listogo-kpi-card.kpi-blue::before { background: #3b82f6; }
.listogo-kpi-card.kpi-purple::before { background: #8b5cf6; }
.listogo-kpi-card.kpi-amber::before { background: #f59e0b; }
.listogo-kpi-card.kpi-rose::before { background: #f43f5e; }

.listogo-kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.listogo-kpi-title {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.listogo-kpi-icon {
    font-size: 1.35rem;
    background: #f1f5f9;
    padding: 8px 10px;
    border-radius: 10px;
}

.listogo-kpi-value {
    font-size: 1.85rem;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.listogo-kpi-sub {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Data Tables */
.listogo-table-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    margin-bottom: 32px;
}

.listogo-table-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.listogo-table-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.listogo-table-responsive {
    width: 100%;
    overflow-x: auto;
}

.listogo-data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.listogo-data-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.listogo-data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.listogo-data-table tr:hover td {
    background: #f8fafc;
}

/* Status Badges */
.listogo-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-dark { background: #e2e8f0; color: #334155; }

/* Action Cards Grid */
.listogo-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.listogo-action-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.listogo-action-card h3 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.listogo-action-card p {
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.5;
    margin: 0 0 18px;
}

/* Buttons */
.listogo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fd5100;
    color: #ffffff !important;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(253, 81, 0, 0.25);
}

.listogo-btn:hover {
    background: #e04700;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(253, 81, 0, 0.35);
}

.listogo-btn-dark {
    background: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

.listogo-btn-dark:hover {
    background: #1e293b;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.3);
}

.listogo-btn-outline {
    background: transparent;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
    box-shadow: none;
}

.listogo-btn-outline:hover {
    background: #f1f5f9;
}

/* KDS Grid Styles */
.listogo-kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; padding: 16px; }
.listogo-kds-card { background: #fff; border: 2px solid #e2e8f0; border-radius: 12px; padding: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.listogo-kds-card.warning-timer { border-color: #f59e0b; background: #fffbeb; }
.listogo-kds-card.danger-timer { border-color: #ef4444; background: #fef2f2; animation: pulse 1.5s infinite; }
.listogo-kds-timer { font-size: 1.5rem; font-weight: 700; color: #fd5100; margin-bottom: 8px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.8; } }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .listogo-main-content {
        padding: 24px 20px;
    }
    .listogo-sidebar {
        width: 230px;
        min-width: 230px;
    }
}

/* Sticky Header and Anti-Shift Layout */
.listogo-sticky-header {
    position: sticky;
    top: 0;
    z-index: 99;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 24px;
    margin: -24px -28px 24px -28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.listogo-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.listogo-mobile-menu-toggle {
    display: none;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 1.2rem;
    cursor: pointer;
}

.listogo-header-brand-title {
    font-weight: 800;
    font-size: 1.15rem;
    color: #0f172a;
    letter-spacing: -0.3px;
}

.listogo-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.listogo-header-branch-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff7ed;
    border: 1.5px solid #fed7aa;
    border-radius: 12px;
    padding: 6px 14px;
}

.listogo-header-branch-pill select {
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 0.88rem;
    color: #0f172a;
    outline: none;
    cursor: pointer;
}

.listogo-header-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.listogo-header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
}

.listogo-header-user-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: #334155;
}

/* Prevent horizontal scroll displacing sidebar */
html, body {
    overflow-x: hidden !important;
}

.listogo-app-layout {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Fijo y Aislado: No se desplaza al hacer scroll en el contenido derecho */
@media (min-width: 769px) {
    .listogo-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 270px !important;
        min-width: 270px !important;
        max-width: 270px !important;
        height: 100vh !important;
        z-index: 9999 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        flex-shrink: 0 !important;
    }

    body.admin-bar .listogo-sidebar {
        top: 32px !important;
        height: calc(100vh - 32px) !important;
    }

    .listogo-main-content {
        margin-left: 270px !important;
        width: calc(100% - 270px) !important;
        max-width: calc(100% - 270px) !important;
        min-height: 100vh !important;
        overflow-x: auto !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 768px) {
    body.admin-bar .listogo-sidebar {
        top: 46px !important;
        height: calc(100vh - 46px) !important;
    }
    .listogo-mobile-menu-toggle {
        display: block;
    }
    .listogo-app-layout {
        flex-direction: column;
    }
    .listogo-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        position: relative !important;
    }
    .listogo-sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }
    .listogo-nav-item {
        white-space: nowrap;
        padding: 8px 12px;
    }
    .listogo-main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
    }
    .listogo-sticky-header {
        margin: -24px -20px 20px -20px;
        padding: 10px 16px;
    }
}