:root {
    --bg-color: #05050A;
    --panel-bg: rgba(20, 20, 30, 0.4);
    --panel-border: rgba(255, 255, 255, 0.1);
    --primary-color: #4facfe;
    --secondary-color: #00f2fe;
    --text-main: #ffffff;
    --text-muted: #a0a0b0;
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-border: rgba(255, 255, 255, 0.1);
    --focus-glow: rgba(79, 172, 254, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: float 20s infinite alternate ease-in-out;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: #662d8c;
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--secondary-color);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
    opacity: 0.3;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

/* Container & Panels */
.container {
    width: 100%;
    max-width: 550px;
    padding: 20px;
    perspective: 1000px;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.glass-panel.hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}

.panel-header {
    text-align: center;
    margin-bottom: 30px;
}

.panel-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.highlight {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(79, 172, 254, 0.3);
}

.panel-header p {
    color: var(--text-muted);
    font-weight: 300;
}

/* Forms */
.form-row {
    display: flex;
    gap: 15px;
}

.form-row .input-group {
    flex: 1;
}

.input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.field-hint {
    font-size: 0.72rem;
    margin-top: 4px;
    margin-left: 4px;
    min-height: 14px;
    transition: color 0.2s;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-left: 4px;
    transition: color 0.3s;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    box-sizing: border-box;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    resize: vertical;
}

.input-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 45px;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px var(--focus-glow);
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.input-group select option {
    background: var(--bg-color);
    color: var(--text-main);
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 10px 20px -10px var(--primary-color);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.5s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -10px var(--primary-color);
}

.btn-primary:hover::after {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Footer Links */
.panel-footer {
    margin-top: 25px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.panel-footer a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s, text-shadow 0.3s;
}

.panel-footer a:hover {
    color: #ffffff;
    text-shadow: 0 0 10px var(--secondary-color);
}

/* Responsive */
@media (max-width: 480px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .glass-panel {
        padding: 30px 20px;
    }
}

/* Notificaciones (Toast) */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
}

.notification {
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: 12px;
    min-width: 280px;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left-color: var(--secondary-color);
}

.notification.error {
    border-left-color: #ff4757;
}

.notification-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--secondary-color);
}

.notification.error .notification-icon {
    color: #ff4757;
}

.notification-message {
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.4;
}

/* =========================================
   ESTILOS DEL DASHBOARD ERP
   ========================================= */

.dashboard-body {
    display: block;
    /* Sobrescribir flex center */
    min-height: 100vh;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    gap: 20px;
    box-sizing: border-box;
}

/* Sidebar */
.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: 30px 20px !important;
    border-radius: 20px !important;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 40px;
}

.sidebar-header h2 {
    font-size: 2rem;
    font-weight: 800;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 10px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 400;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.sidebar-nav svg {
    width: 22px;
    height: 22px;
    transition: all 0.3s ease;
}

.sidebar-nav li.active a,
.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.sidebar-nav li.active a svg,
.sidebar-nav a:hover svg {
    color: var(--primary-color);
    filter: drop-shadow(0 0 8px rgba(79, 172, 254, 0.5));
}

.sidebar-footer .logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    color: #ff4757;
    text-decoration: none;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.sidebar-footer .logout-btn:hover {
    background: rgba(255, 71, 87, 0.1);
}

.sidebar-footer .logout-btn svg {
    width: 20px;
    height: 20px;
}

/* Contenido Principal */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-x: hidden;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px !important;
    border-radius: 16px !important;
}

.header-welcome {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Tarjeta bienvenida dashboard */
.bienvenida-card {
    padding: 16px 20px !important;
    border-radius: 14px !important;
}

@media (max-width: 600px) {
    .bienvenida-card {
        padding: 12px 14px !important;
    }
    .bienvenida-card div[style*="font-size:1.2rem"] {
        font-size: 1rem !important;
    }
}

.header-search {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    padding: 10px 20px;
    width: 100%;
    max-width: 400px;
    gap: 10px;
}

.header-search svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.header-search input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    font-size: 0.95rem;
    outline: none;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 25px;
}

.notification-bell {
    position: relative;
    cursor: pointer;
}

.notification-bell svg {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    transition: color 0.3s;
}

.notification-bell:hover svg {
    color: var(--text-main);
}

.notification-bell .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info .avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.3);
}

.user-desc {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
}

.user-role {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* Dashboard Grid (Widgets) */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.widget-card {
    padding: 10px 16px !important;
    border-radius: 10px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-direction: row !important;
}

.widget-icon { display: none; }

.widget-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.widget-info h3 {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.widget-number { display: none; }

.trend {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.trend.positive {
    color: #38ef7d;
}

.trend.negative {
    color: #ff4757;
}

.trend.neutral {
    color: var(--secondary-color);
}

/* Activity Details */
.dashboard-details {
    display: flex;
    gap: 20px;
}

.details-panel {
    width: 100%;
    padding: 20px !important;
    border-radius: 16px !important;
    flex: 1 1 auto;
}



.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--input-border);
    padding-bottom: 8px;
}

.panel-heading h3 {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.72rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
}

.activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 360px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(79, 172, 254, 0.3) transparent;
}

.activity-list li {
    display: block;
    padding: 5px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s;
    line-height: 1.3;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-list li:hover {
    background: rgba(79, 172, 254, 0.04);
}

/* Separador de semana */
.week-separator {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-color);
    padding: 8px 10px 4px;
    border-bottom: 1px solid rgba(79, 172, 254, 0.15);
    border-top: 1px solid rgba(79, 172, 254, 0.08);
    background: rgba(79, 172, 254, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.week-separator .week-toggle {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.week-group.collapsed .week-toggle {
    transform: rotate(-90deg);
}

.week-group-items {
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.week-group.collapsed .week-group-items {
    max-height: 0 !important;
}

.activity-avatar {
    display: none;
}

.activity-text {
    display: block;
    width: 100%;
}

.activity-text p {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-main);
    line-height: 1.3;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-text .activity-note-line {
    font-size: 0.78rem;
    color: var(--text-main);
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0 10px;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
}

.activity-note-line .note-detail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-note-line .note-user {
    color: var(--text-muted);
    font-size: 0.72rem;
    border-left: 1px solid rgba(255,255,255,0.12);
    padding-left: 8px;
    white-space: nowrap;
}

.activity-note-line .note-time {
    color: var(--secondary-color);
    font-size: 0.7rem;
    border-left: 1px solid rgba(255,255,255,0.12);
    padding-left: 8px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.activity-text strong {
    color: var(--primary-color);
    font-weight: 600;
}

.activity-text em {
    color: #f2c94c;
    font-style: normal;
    font-weight: 500;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Responsividad del Dashboard */
@media (max-width: 900px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: column;
        padding: 8px 12px !important;
        gap: 4px;
    }

    .sidebar-header {
        margin-bottom: 0;
    }

    .sidebar-header h2 { font-size: 1.3rem; }

    /* Iconos + logout en una sola fila */
    .sidebar-nav { width: 100%; }
    .sidebar-nav ul {
        display: flex;
        gap: 2px;
        flex-wrap: nowrap;
        overflow-x: auto;
        align-items: center;
    }
    .sidebar-nav li { margin-bottom: 0; }
    .sidebar-nav a {
        padding: 7px 9px;
        font-size: 0;
        gap: 0;
    }
    .sidebar-nav a svg { width: 19px; height: 19px; }

    .sidebar-footer {
        position: absolute;
        right: 12px;
        bottom: 8px;
    }
    .sidebar-footer .logout-btn {
        font-size: 0;
        padding: 7px 9px;
    }
    .sidebar-footer .logout-btn svg { margin-right: 0; }

    .sidebar { position: relative; }

    /* Widgets: 2x2 en tablet */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
}

@media (max-width: 600px) {
    .top-header {
        flex-direction: row;
        gap: 10px;
        padding: 10px 14px !important;
    }

    .header-welcome {
        flex: 1;
        min-width: 0;
    }

    .header-welcome span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Widgets: 2x2 en móvil pequeño */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    .dashboard-details {
        flex-direction: column;
    }
}

/* =========================================
   ESTILOS DE VISTAS INTERNAS (TABS)
   ========================================= */

.view-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view-section.active-view {
    display: block;
}

.view-section.hidden-view {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Formularios Internos */
.custom-form {
    max-width: 600px;
}

/* Tarjetas de Agenda (Radio Buttons Customizados) */
.agenda-card {
    cursor: pointer;
    position: relative;
    display: block;
}

.agenda-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.agenda-content {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.agenda-content h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 5px;
}

.agenda-content p {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.agenda-card:hover .agenda-content {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.agenda-card input[type="radio"]:checked+.agenda-content {
    background: rgba(79, 172, 254, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.3);
}

.agenda-card input[type="radio"]:focus-visible+.agenda-content {
    outline: 2px solid var(--secondary-color);
    outline-offset: 4px;
}

/* Disposición Vertical para Agenda */
.agenda-list-vertical {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Separación amplia entre tarjetas */
    width: 100%;
}

.agenda-list-vertical .agenda-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    text-align: left;
}

.agenda-list-vertical .agenda-content h3 {
    margin-bottom: 0;
    font-size: 1.2rem;
}

.agenda-list-vertical .agenda-content p {
    font-size: 1.2rem;
    font-weight: 600;
}

/* =========================================
   AGENDA DINAMICA (POR MATRIZ DE TABLA)
   ========================================= */
.agenda-section-title {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-left: 4px solid var(--secondary-color);
    padding-left: 10px;
}

.text-center {
    text-align: center !important;
}

.agenda-reserve-table th {
    background: rgba(255, 255, 255, 0.02);
}

.agenda-reserve-table th small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.time-checkbox {
    display: none;
}

.time-label {
    display: inline-block;
    padding: 10px 18px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    text-align: center;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.compact-label {
    padding: 6px 12px;
    font-size: 0.85rem;
    width: 100%;
}

.time-checkbox:checked + .time-label {
    background: rgba(79, 172, 254, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.2);
}

.time-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* =========================================
   TABLA DE USUARIOS
   ========================================= */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.users-table th, .users-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.users-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 600;
}

.users-table td {
    font-size: 0.95rem;
    color: var(--text-main);
    vertical-align: middle;
}

.users-table tbody tr {
    transition: background 0.3s ease;
}

.users-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 15px;
}

.role-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.role-admin {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.role-superlider {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.role-lider {
    background: rgba(79, 172, 254, 0.15);
    color: #4facfe;
    border: 1px solid rgba(79, 172, 254, 0.3);
}

.role-siervo {
    background: rgba(46, 213, 115, 0.15);
    color: #2ed573;
    border: 1px solid rgba(46, 213, 115, 0.3);
}

/* =========================================
   MODALES (EDICIÓN Y OTROS)
   ========================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.modal-content {
    background: var(--panel-bg);
    width: 90%;
    max-width: 500px;
    padding: 30px;
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--primary-color);
}

/* =========================================
   NUEVAS MEJORAS
   ========================================= */

/* Filtros de tabla */
.filter-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 6px 12px;
    font-size: 0.82rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--primary-color); }
.filter-select option { background: var(--bg-color); }

/* Botón peligro (eliminar) */
.btn-danger {
    background: rgba(255,71,87,0.15);
    border: 1px solid rgba(255,71,87,0.4);
    color: #ff4757;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-danger:hover { background: rgba(255,71,87,0.3); }

/* Botón degradar rol */
.btn-downgrade {
    background: rgba(255,165,0,0.15);
    border: 1px solid rgba(255,165,0,0.4);
    color: #ffa500;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-downgrade:hover { background: rgba(255,165,0,0.3); }

/* Tarjetas de proyecto */
.proyecto-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    transition: background 0.2s;
}
.proyecto-card:hover { background: rgba(255,255,255,0.05); }
.proyecto-card-info h4 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.proyecto-card-info p  { font-size: 0.82rem; color: var(--text-muted); }
.proyecto-card-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* Badges de estado de proyecto */
.estado-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}
.estado-planificado { background: rgba(79,172,254,0.15); color: #4facfe; border: 1px solid rgba(79,172,254,0.3); }
.estado-en-curso    { background: rgba(255,165,0,0.15);  color: #ffa500; border: 1px solid rgba(255,165,0,0.3); }
.estado-completado  { background: rgba(46,213,115,0.15); color: #2ed573; border: 1px solid rgba(46,213,115,0.3); }

/* Checkbox deshabilitado (ya reservado) */
.time-checkbox:disabled + .time-label {
    background: rgba(46,213,115,0.1);
    border-color: rgba(46,213,115,0.4);
    color: #2ed573;
    cursor: default;
    opacity: 0.8;
}

/* Modo claro */
body.light-mode {
    --bg-color: #f0f2f8;
    --panel-bg: rgba(255,255,255,0.75);
    --panel-border: rgba(0,0,0,0.1);
    --text-main: #1a1a2e;
    --text-muted: #555577;
    --input-bg: rgba(0,0,0,0.05);
    --input-border: rgba(0,0,0,0.15);
    --focus-glow: rgba(79,172,254,0.3);
}
body.light-mode { background-color: var(--bg-color); }
body.light-mode .glow-orb { opacity: 0.15; }

/* Areas grid en formulario de proyectos */
.areas-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px 0;
}
.area-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.area-row::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--area-color, var(--primary-color));
    border-radius: 3px 0 0 3px;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.area-row.area-activa::before { opacity: 1; }
.area-row.area-activa {
    background: rgba(79,172,254,0.07);
    border-color: rgba(79,172,254,0.25);
}
.area-row[data-area="Visuales"]    { --area-color: #4facfe; }
.area-row[data-area="Filmakers"]   { --area-color: #a855f7; }
.area-row[data-area="Fotografía"]  { --area-color: #f59e0b; }
.area-row[data-area="Coordinación"]{ --area-color: #10b981; }
.area-row[data-area="Switchers"]   { --area-color: #ef4444; }
.area-row[data-area="Streaming"]   { --area-color: #06b6d4; }
.area-row[data-area="Luces"]       { --area-color: #fbbf24; }
.area-row[data-area="Diseño"]      { --area-color: #ec4899; }
.area-row[data-area="Edición"]     { --area-color: #8b5cf6; }
.area-row[data-area="Protocolos"]  { --area-color: #14b8a6; }
.area-row[data-area="Cámaras"]     { --area-color: #f97316; }
.area-icono {
    font-size: 1.2rem;
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}
.area-nombre {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.area-row.area-activa .area-nombre {
    color: var(--text-main);
    font-weight: 600;
}
.area-counter {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.area-counter-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.area-counter-btn:hover {
    background: var(--area-color, var(--primary-color));
    color: white;
    opacity: 0.85;
}
.area-cantidad {
    width: 30px !important;
    padding: 0 !important;
    text-align: center;
    border: none !important;
    border-left: 1px solid rgba(255,255,255,0.08) !important;
    border-right: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 0 !important;
    font-size: 0.82rem !important;
    font-weight: 700;
    background: transparent !important;
    color: var(--text-main) !important;
    height: 26px;
}
.area-row.area-activa .area-cantidad { color: var(--area-color, var(--primary-color)) !important; }
.area-label { display: none; }

@media (max-width: 500px) {
    .areas-container { grid-template-columns: 1fr; }
}

/* Badge de área en modal de proyecto */
.area-badge {
    display: inline-block;
    background: rgba(79,172,254,0.1);
    border: 1px solid rgba(79,172,254,0.25);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.8rem;
    margin: 2px;
    color: var(--text-main);
}
.area-badge strong { color: var(--primary-color); }

/* Historial de proyectos */
.historial-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--panel-border);
    margin-bottom: 6px;
    gap: 10px;
}
.historial-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.historial-nombre { font-size: 0.88rem; font-weight: 500; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.historial-fecha  { font-size: 0.75rem; color: var(--text-muted); }

/* Tarjetas de proyecto con color por estado */
.proyecto-card { border-left: 3px solid var(--panel-border); }
.proyecto-card.estado-planificado-card { border-left-color: #4facfe; }
.proyecto-card.estado-en-curso-card    { border-left-color: #ffa500; }
.proyecto-card.estado-completado-card  { border-left-color: #2ed573; }

/* Sidebar activo en móvil (iconos) */
@media (max-width: 900px) {
    .sidebar-nav li.active a {
        background: rgba(79,172,254,0.15);
        border-radius: 10px;
    }
    .sidebar-nav li.active a svg { color: var(--primary-color); }
}

/* Estado de tarea */
.tarea-estado {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    margin-left: 6px;
    cursor: pointer;
}
.tarea-pendiente   { background: rgba(160,160,176,0.15); color: #a0a0b0; border: 1px solid rgba(160,160,176,0.3); }
.tarea-en-progreso { background: rgba(255,165,0,0.15);   color: #ffa500; border: 1px solid rgba(255,165,0,0.3); }
.tarea-completada  { background: rgba(46,213,115,0.15);  color: #2ed573; border: 1px solid rgba(46,213,115,0.3); }

/* Comentarios */
.comentarios-section { margin-top: 12px; border-top: 1px solid var(--panel-border); padding-top: 10px; }
.comentario-item { padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.03); margin-bottom: 6px; font-size: 0.82rem; }
.comentario-autor { font-weight: 600; color: var(--primary-color); margin-right: 6px; }
.comentario-hora  { color: var(--text-muted); font-size: 0.72rem; margin-left: 6px; }
.comentario-input-row { display: flex; gap: 8px; margin-top: 8px; }
.comentario-input-row input { flex: 1; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 8px; padding: 7px 12px; color: var(--text-main); font-size: 0.85rem; outline: none; }
.comentario-input-row input:focus { border-color: var(--primary-color); }
.comentario-input-row button { padding: 7px 14px; font-size: 0.82rem; }

/* Confirmación asistencia */
.asistencia-btn { padding: 5px 12px; border-radius: 8px; font-size: 0.78rem; cursor: pointer; border: 1px solid; transition: all 0.2s; }
.asistencia-confirmar { background: rgba(46,213,115,0.1); color: #2ed573; border-color: rgba(46,213,115,0.4); }
.asistencia-confirmar:hover { background: rgba(46,213,115,0.25); }
.asistencia-no-puedo  { background: rgba(255,71,87,0.1);  color: #ff4757; border-color: rgba(255,71,87,0.4); }
.asistencia-no-puedo:hover  { background: rgba(255,71,87,0.25); }
.asistencia-confirmado { background: rgba(46,213,115,0.2); color: #2ed573; border-color: #2ed573; cursor: default; }
.asistencia-rechazado  { background: rgba(255,71,87,0.2);  color: #ff4757; border-color: #ff4757; cursor: default; }

/* Dashboard vacío — bienvenida */
.dash-bienvenida { text-align: center; padding: 30px 20px; color: var(--text-muted); }
.dash-bienvenida .dash-bienvenida-icon { font-size: 2.5rem; margin-bottom: 10px; }
.dash-bienvenida p { font-size: 0.9rem; line-height: 1.6; }
.dash-bienvenida .proximo-servicio { margin-top: 14px; background: rgba(79,172,254,0.08); border: 1px solid rgba(79,172,254,0.2); border-radius: 12px; padding: 12px 16px; color: var(--text-main); font-size: 0.88rem; }

/* Panel de notificaciones */
.notif-panel {
    position: fixed;
    width: 320px;
    background: #13131f;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    z-index: 9999;
    overflow: hidden;
}
body.light-mode .notif-panel { background: #ffffff; border-color: rgba(0,0,0,0.12); }
.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border);
    font-size: 0.85rem;
    font-weight: 600;
}
.notif-lista { list-style:none; max-height: 320px; overflow-y:auto; padding:6px 0; }
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.82rem;
    border-left: 3px solid transparent;
    transition: background 0.2s;
}
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item.notif-error  { border-left-color: #ff4757; }
.notif-item.notif-warn   { border-left-color: #ffa500; }
.notif-item.notif-info   { border-left-color: #4facfe; }
.notif-item.notif-leida  { opacity: 0.45; }
.notif-icon  { font-size: 1rem; flex-shrink:0; margin-top:1px; }
.notif-texto { color: var(--text-main); line-height: 1.4; }
.notif-empty { padding: 20px 16px; color: var(--text-muted); font-size:0.85rem; text-align:center; }

/* Calendario visual de proyectos */
.cal-header { font-size:0.9rem; font-weight:600; margin-bottom:10px; color:var(--primary-color); }
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-dia-label {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    padding: 4px 0;
    text-transform: uppercase;
}
.cal-celda {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    position: relative;
    gap: 2px;
    min-height: 36px;
}
.cal-celda.vacia { background: transparent; }
.cal-celda.cal-hoy { background: rgba(79,172,254,0.15); color: var(--primary-color); font-weight: 700; border: 1px solid rgba(79,172,254,0.4); }
.cal-celda.cal-tiene-evento { color: var(--text-main); }
.cal-punto { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin: 0 1px; }

/* Resumen asistencia en tarjeta proyecto */
.proy-asistencia-resumen { font-size:0.75rem; margin-top:4px; display:flex; gap:10px; }
.asist-ok   { color: #2ed573; font-weight:600; }
.asist-no   { color: #ff4757; font-weight:600; }
.asist-pend { color: var(--text-muted); }

/* Cuenta regresiva */
.proy-cuenta-regresiva { font-size:0.78rem; color:var(--secondary-color); margin-top:4px; }

.recurso-servicio-sep {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-color);
    padding: 10px 4px 4px;
    border-bottom: 1px solid rgba(79,172,254,0.15);
    margin-bottom: 6px;
    margin-top: 8px;
}

/* Recursos */
.recurso-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--panel-border);
    margin-bottom: 8px;
    transition: background 0.2s;
}
.recurso-card:hover { background: rgba(255,255,255,0.07); }
.recurso-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    color: var(--text-main);
    min-width: 0;
}
.recurso-thumb {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: rgba(0,0,0,0.3);
}
.recurso-thumb-placeholder {
    width: 80px;
    height: 50px;
    border-radius: 6px;
    background: rgba(79,172,254,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.recurso-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.recurso-titulo { font-size: 0.9rem; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recurso-url    { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recurso-link:hover .recurso-titulo { color: var(--primary-color); }

/* Tarea card (vista usuario) */
.tarea-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 6px 0;
    transition: background 0.2s;
}
.tarea-card:hover { background: rgba(255,255,255,0.06); }
.tarea-card-completada { opacity: 0.5; }
.tarea-card-completada .tarea-card-titulo { text-decoration: line-through; }
.tarea-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.tarea-card-titulo {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
}
.tarea-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 10px;
    line-height: 1.5;
}
.tarea-card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 10px;
    margin-top: 4px;
}
.tarea-aceptacion-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
}

/* Tarea meta row */
.tarea-meta-row { display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin-top:4px; padding-left:4px; }

/* Prioridad de tarea */
.tarea-prioridad { display:inline-block; padding:1px 8px; border-radius:20px; font-size:0.68rem; font-weight:700; }
.prio-alta  { background:rgba(255,71,87,0.15);   color:#ff4757; border:1px solid rgba(255,71,87,0.4); }
.prio-media { background:rgba(255,165,0,0.15);   color:#ffa500; border:1px solid rgba(255,165,0,0.4); }
.prio-baja  { background:rgba(46,213,115,0.15);  color:#2ed573; border:1px solid rgba(46,213,115,0.4); }

/* Urgencia de vencimiento */
.tarea-urgencia { display:inline-block; padding:1px 8px; border-radius:20px; font-size:0.68rem; font-weight:600; }
.tarea-urgencia.vencida { background:rgba(255,71,87,0.2);   color:#ff4757; border:1px solid rgba(255,71,87,0.5); }
.tarea-urgencia.hoy     { background:rgba(255,165,0,0.2);   color:#ffa500; border:1px solid rgba(255,165,0,0.5); }
.tarea-urgencia.pronto  { background:rgba(255,209,102,0.15);color:#ffd166; border:1px solid rgba(255,209,102,0.4); }
.tarea-urgencia.ok      { background:rgba(255,255,255,0.05);color:var(--text-muted); border:1px solid rgba(255,255,255,0.1); }

/* Tarea completada — atenuada */
.tarea-item-completada { opacity: 0.5; }
.tarea-item-completada .note-detail { text-decoration: line-through; }

/* Descripcion de tarea */
.tarea-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 3px 4px 3px 22px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reservas modal grid */
.reservas-grid { display: flex; flex-direction: column; gap: 10px; }
.reserva-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    font-size: 0.88rem;
}
.reserva-item .reserva-servicio { color: var(--text-main); font-weight: 500; }
.reserva-item .reserva-usuario  { color: var(--secondary-color); font-size: 0.8rem; }

/* Proy modal */
.proy-detail-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start; font-size: 0.9rem; }
.proy-detail-row span:first-child { color: var(--text-muted); min-width: 100px; }

/* ─── AGENDA: COLORES POR TIPO DE DÍA ─────────────────────── */
.agenda-title-domingo  { color: #ffd166; border-left: 3px solid #ffd166; padding-left: 10px; }
.agenda-title-miercoles { color: #a29bfe; border-left: 3px solid #a29bfe; padding-left: 10px; }

.agenda-col-domingo  { background: rgba(255, 209, 102, 0.07); color: #ffd166; }
.agenda-col-miercoles { background: rgba(162, 155, 254, 0.07); color: #a29bfe; }

.agenda-cell-domingo  { background: rgba(255, 209, 102, 0.04); }
.agenda-cell-miercoles { background: rgba(162, 155, 254, 0.04); }

.agenda-table-domingo  thead th  { border-bottom: 2px solid rgba(255, 209, 102, 0.3); }
.agenda-table-miercoles thead th { border-bottom: 2px solid rgba(162, 155, 254, 0.3); }

/* ─── SERVICIOS SEMANA: PANEL DASHBOARD ────────────────────── */
#servicios-semana-list { list-style: none; padding: 0; margin: 0; }

.semana-group-sep {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 8px 0 4px;
    margin-top: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.semana-sep-domingo   { color: #ffd166; }
.semana-sep-miercoles { color: #a29bfe; }

.semana-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.semana-item-domingo  { border-left: 2px solid rgba(255, 209, 102, 0.4); padding-left: 8px; }
.semana-item-miercoles { border-left: 2px solid rgba(162, 155, 254, 0.4); padding-left: 8px; }

.semana-nombre  { font-weight: 600; color: var(--text-main); min-width: 120px; }
.semana-area    { color: var(--text-muted); font-size: 0.78rem; background: rgba(255,255,255,0.06); padding: 2px 7px; border-radius: 20px; }
.semana-servicio { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }

/* =========================================
   SISTEMA DE PRESENCIA Y CHAT EN TIEMPO REAL
   ========================================= */

/* Elemento de lista de usuarios en el chat */
.chat-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s, border-left-color 0.2s;
    border-left: 3px solid transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.chat-user-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.chat-user-item.active {
    background-color: rgba(79, 172, 254, 0.08);
    border-left-color: var(--primary-color);
}

/* Indicador de conexión / Presencia */
.presence-badge {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 4px;
}

.presence-badge.online {
    background-color: #2ed573;
    box-shadow: 0 0 8px rgba(46, 213, 115, 0.6);
}

.presence-badge.offline {
    background-color: #7f8c8d;
}

/* Burbujas de mensajes */
.message-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    max-width: 75%;
}

.message-row.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.message-row.received {
    align-self: flex-start;
    align-items: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sent .message-bubble {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-bottom-right-radius: 4px;
}

.received .message-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

/* Estilo para las fotos en el chat / lista de usuarios */
.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
}

.chat-avatar-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
}

/* Responsividad para móviles del panel de chat */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column !important;
        height: calc(100vh - 160px) !important;
    }
    
    .chat-sidebar {
        width: 100% !important;
        height: 110px !important;
        border-right: none !important;
        border-bottom: 1px solid var(--panel-border) !important;
    }
    
    #chat-users-list {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 8px !important;
        gap: 8px;
    }
    
    .chat-user-item {
        flex-direction: column !important;
        border-left: none !important;
        border-bottom: none !important;
        border-radius: 8px;
        padding: 8px 12px !important;
        min-width: 75px;
        text-align: center;
        gap: 6px;
    }
    
    .chat-user-item.active {
        background-color: rgba(79, 172, 254, 0.15);
        border-bottom: 3px solid var(--primary-color) !important;
    }
    
    .chat-user-item .chat-user-info {
        display: none !important; /* Ocultar texto en la lista horizontal */
    }
}

/* ==========================================================================
   WIDGET FLOTANTE DE USUARIOS EN LÍNEA (PERSISTENTE EN TODAS LAS VISTAS)
   ========================================================================== */
#online-users-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: inherit;
}

#online-widget-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(30, 30, 40, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 16px rgba(79, 172, 254, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#online-widget-toggle:hover {
    transform: translateY(-3px) scale(1.02);
    border-color: rgba(79, 172, 254, 0.4);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(79, 172, 254, 0.3);
}

#online-users-widget.widget-open #online-widget-toggle {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #2ed573;
    display: inline-block;
}

.online-dot.pulsing {
    box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(46, 213, 115, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0);
    }
}

#online-widget-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 300px;
    max-height: 400px;
    border-radius: 16px;
    background: rgba(20, 20, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(79, 172, 254, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

#online-users-widget.widget-open #online-widget-panel {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.online-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.online-panel-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

#online-widget-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

#online-widget-close:hover {
    color: #ff4757;
}

#online-widget-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 330px;
}

.online-widget-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.online-widget-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.online-widget-item img, .online-widget-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.online-widget-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.online-widget-info {
    flex: 1;
    min-width: 0;
}

.online-widget-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-widget-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.online-widget-badge {
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 600;
    background: rgba(79, 172, 254, 0.15);
    border: 1px solid rgba(79, 172, 254, 0.2);
    color: var(--primary-color);
}
