/* ══════════════════════════════════════════════
   SIDEBAR YOURCOMER — sidebar.css
   Claro, legible, coherente con el sistema
══════════════════════════════════════════════ */

:root {
    --sb-w: 256px;
    --sb-wc: 68px;
    --sb-bg: var(--tema-primary, #667eea);
    --sb-bg2: var(--tema-primary-dark, #764ba2);
    --sb-border: rgba(255, 255, 255, .12);
    --sb-text: rgba(255, 255, 255, .88);
    --sb-dim: rgba(255, 255, 255, .5);
    --sb-hover: rgba(255, 255, 255, .14);
    --sb-active: rgba(255, 255, 255, .22);
    --sb-accent: #c4b5fd;
    --fd: 'Outfit', sans-serif;
    --fb: 'Plus Jakarta Sans', sans-serif;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sb-w);
    background: var(--tema-sb-gradient, linear-gradient(160deg, #667eea 0%, #764ba2 100%));
    border-right: 1px solid rgba(255, 255, 255, .12);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transition: width .25s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 3px 0 20px rgba(0, 0, 0, .25);
}

.sidebar.collapsed {
    width: var(--sb-wc);
}

.sb-tog {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 24px;
    height: 24px;
    background: var(--tema-primary-dark, #764ba2);
    border: 1.5px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sb-accent);
    font-size: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
    transition: background .15s, color .15s, transform .15s;
    z-index: 10;
    flex-shrink: 0;
}

.sb-tog:hover {
    background: var(--tema-primary, #667eea);
    color: white;
    border-color: var(--tema-primary, #667eea);
    transform: scale(1.1);
}

.sb-user {
    margin: 12px 10px 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.sb-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: white;
    font-family: var(--fd);
}

.sb-uinfo {
    overflow: hidden;
    flex: 1;
    min-width: 0;
    transition: opacity .2s, max-width .2s;
    max-width: 200px;
}

.sb-uname {
    font-size: 13px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--fb);
}

.sb-urole {
    font-size: 11px;
    color: var(--sb-dim);
    white-space: nowrap;
    font-family: var(--fb);
}

.sidebar.collapsed .sb-uinfo {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

.sb-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.sb-nav::-webkit-scrollbar {
    width: 3px;
}

.sb-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .15);
    border-radius: 2px;
}

.sb-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 2px 8px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    color: var(--sb-text);
    font-size: 13.5px;
    font-weight: 500;
    font-family: var(--fb);
    transition: background .15s, color .15s;
    position: relative;
    white-space: nowrap;
    border: 1px solid transparent;
    user-select: none;
}

.sb-link:hover {
    background: var(--sb-hover);
    color: white;
}

.sb-link.active {
    background: var(--sb-active);
    border-color: rgba(255, 255, 255, .2);
    color: white;
}

.sb-link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    border-radius: 0 2px 2px 0;
    background: var(--sb-accent);
}

.sb-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: transform .15s;
    background: rgba(255, 255, 255, .12) !important;
    color: white !important;
}

.sb-link:hover .sb-icon {
    transform: scale(1.08);
}

.sb-lbl {
    flex: 1;
    transition: opacity .2s, max-width .2s;
    max-width: 200px;
    overflow: hidden;
}

.sidebar.collapsed .sb-lbl {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

.sb-chev {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform .2s, opacity .2s;
    color: var(--sb-dim);
}

.sb-link.open .sb-chev {
    transform: rotate(180deg);
}

.sidebar.collapsed .sb-chev {
    opacity: 0;
    pointer-events: none;
}

.sb-sub {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s cubic-bezier(.4, 0, .2, 1);
}

.sb-sub.open {
    max-height: 400px;
}

.sidebar.collapsed .sb-sub {
    display: none;
}

.sb-sublink {
    display: flex;
    align-items: center;
    padding: 8px 12px 8px 52px;
    margin: 1px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--sb-dim);
    font-size: 12.5px;
    font-weight: 500;
    font-family: var(--fb);
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.sb-sublink:hover {
    background: var(--sb-hover);
    color: white;
}

.sb-sublink.active {
    background: rgba(255, 255, 255, .2);
    color: white;
    font-weight: 600;
}

.sb-foot {
    padding: 10px 8px;
    border-top: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.sb-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--sb-dim);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--fb);
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.sb-logout:hover {
    background: rgba(239, 68, 68, .15);
    color: #fca5a5;
}

.sb-lico {
    font-size: 14px;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.sb-ltxt {
    transition: opacity .2s, max-width .2s;
    max-width: 200px;
}

.sidebar.collapsed .sb-ltxt {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sb-w) !important;
        transition: transform .25s cubic-bezier(.4, 0, .2, 1);
        top: 60px !important;
        height: calc(100vh - 60px) !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sb-tog {
        display: none;
    }
}

/* ══════════════════════════════════════════════
   APP LAYOUT — sidebar + content
   Aplicar en todas las páginas con sesión
══════════════════════════════════════════════ */

/* Wrapper principal del contenido — margen que reacciona al sidebar */
.app-content {
    margin-top: 60px;
    margin-left: var(--sb-w);
    transition: margin-left .25s cubic-bezier(.4, 0, .2, 1);
    min-height: calc(100vh - 60px);
    padding: 24px;
    box-sizing: border-box;
    background: #f1f5f9;
}

body.sb-col .app-content {
    margin-left: var(--sb-wc);
}

/* Content section — misma tarjeta visual que index.php */
.content-section {
    background: linear-gradient(135deg, rgb(102 126 234 / 73%) 0%, rgb(118 75 162 / 62%) 100%);
    border: 1px solid rgba(102, 126, 234, .15);
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(102, 126, 234, .06), 0 1px 4px rgba(0, 0, 0, .04);
    margin-bottom: 20px;
    background-color: white;
}

/* Título de sección */
.content-section h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #1e1b4b;
    margin: 0 0 20px;
}

/* Compatibilidad legacy: .container y .content sin posicionamiento fijo */
.container {
    margin-left: 0 !important;
    display: block !important;
}

.content {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    height: auto !important;
    overflow: visible !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
}

@media (max-width: 768px) {
    .app-content {
        margin-left: 0 !important;
        padding: 12px;
    }

    body.sb-col .app-content {
        margin-left: 0 !important;
    }
}