/* ============================================
   FEED LAYOUT 3 COLUNAS (Estilo Bitrix24)
   ============================================ */

/* Layout Principal - 3 Colunas */
.feed-layout {
    display: flex;
    gap: 1.5rem;
    max-width: 1920px;
    margin: 0 auto;
}

/* ============================================
   SIDEBAR ESQUERDA (Navegação)
   ============================================ */

.feed-sidebar-left {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
}

/* ============================================
   CENTRO (Feed Principal)
   ============================================ */

.feed-main {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
}

/* ============================================
   SIDEBAR DIREITA (Widgets)
   ============================================ */

.feed-sidebar-right {
    width: 320px;
    min-width: 320px;
    flex-shrink: 0;
}

/* ============================================
   STICKY SIDEBARS
   ============================================ */

.sidebar-sticky {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-bottom: 1rem;
}

/* Scrollbar customizado */
.sidebar-sticky::-webkit-scrollbar {
    width: 6px;
}

.sidebar-sticky::-webkit-scrollbar-track {
    background: rgba(51, 65, 85, 0.2);
    border-radius: 3px;
}

.sidebar-sticky::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

.sidebar-sticky::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* ============================================
   WIDGET CARD
   ============================================ */

.widget-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.3);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(51, 65, 85, 0.3);
}

.widget-header h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-header h6 i {
    color: var(--primary-color);
}

.widget-body {
    padding: 1rem;
}

.widget-refresh {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s;
    border-radius: 4px;
}

.widget-refresh:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.widget-refresh.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   STAT ROW (Estatísticas em Linha)
   ============================================ */

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    transition: background 0.2s;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row:hover {
    background: rgba(51, 65, 85, 0.2);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: 4px;
}

.stat-row span:first-child {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-row span:last-child {
    font-weight: 600;
    font-size: 1rem;
}

/* ============================================
   ALERT ITEM (Alertas Recentes)
   ============================================ */

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(51, 65, 85, 0.2);
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    cursor: pointer;
}

.alert-item:hover {
    background: rgba(51, 65, 85, 0.4);
    transform: translateX(4px);
}

.alert-item:last-child {
    margin-bottom: 0;
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.alert-icon.critical {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

.alert-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
}

.alert-icon.info {
    background: rgba(99, 102, 241, 0.15);
    color: #6366F1;
}

.alert-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.alert-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-title {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    font-weight: 600;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.sidebar-nav a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    transform: translateX(4px);
}

.sidebar-nav a.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
}

/* ============================================
   SEARCH BOX
   ============================================ */

.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    background: rgba(51, 65, 85, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(51, 65, 85, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* ============================================
   QUICK ACTIONS
   ============================================ */

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: rgba(51, 65, 85, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.quick-action-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.quick-action-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.widget-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.widget-empty i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.widget-empty p {
    font-size: 0.875rem;
    margin: 0;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

/* Tablet (768px - 1199px) */
@media (max-width: 1199px) {
    .feed-sidebar-left {
        position: fixed;
        top: 60px;
        left: -300px;
        height: calc(100vh - 60px);
        width: 280px;
        background: var(--dark-bg);
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
        padding: 1rem;
        overflow-y: auto;
    }

    .feed-sidebar-left.show {
        left: 0;
    }

    .feed-sidebar-right {
        width: 280px;
        min-width: 280px;
    }

    .feed-main {
        max-width: 600px;
    }

    /* Overlay para sidebar mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* Mobile (<768px) */
@media (max-width: 767px) {
    .feed-layout {
        flex-direction: column;
        gap: 0;
    }

    .feed-sidebar-left,
    .feed-sidebar-right {
        display: none;
    }

    .feed-main {
        width: 100%;
        max-width: 100%;
    }

    /* Botão flutuante para widgets mobile */
    .widgets-floating-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary-color);
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
        cursor: pointer;
        z-index: 100;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        transition: all 0.3s;
    }

    .widgets-floating-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(99, 102, 241, 0.6);
    }
}

/* Desktop grande (>1600px) */
@media (min-width: 1600px) {
    .feed-sidebar-left {
        width: 320px;
        min-width: 320px;
    }

    .feed-sidebar-right {
        width: 360px;
        min-width: 360px;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */

.widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.widget-loading .spinner-border {
    width: 2rem;
    height: 2rem;
}

/* ============================================
   BADGE DE NOTIFICAÇÃO
   ============================================ */

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #EF4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* ============================================
   UTILITIES
   ============================================ */

.text-success {
    color: #10B981 !important;
}

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

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

.text-info {
    color: #6366F1 !important;
}

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