/**
 * Jedi Projects - CSS de Notificações e Dashboard Avançado
 * Estilos para sininho, filtros e widget de pendências
 */

/* ================================================
   CONTAINER DE NOTIFICAÇÕES (SININHO)
   ================================================ */

.notifications-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
}

.notifications-container.notifications-floating {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 9999;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Botão de Ajuda (?) */
.help-button {
    background: white;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.help-button:hover {
    background-color: #2c75e4;
    color: white;
    transform: scale(1.05);
}

.help-icon {
    font-size: 1rem;
    font-weight: 700;
    color: #2c75e4;
}

.help-button:hover .help-icon {
    color: white;
}

.notifications-bell {
    background: white;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.2s;
}

.notifications-bell:hover {
    background-color: rgba(0, 59, 74, 0.1);
}

.bell-icon {
    font-size: 1.25rem;
}

.notifications-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ================================================
   DROPDOWN DE NOTIFICAÇÕES
   ================================================ */

.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10000;
    overflow: hidden;
}

.notifications-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.notifications-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #2c75e4;
}

.notifications-header .mark-all-read {
    background: none;
    border: none;
    color: #2c75e4;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 4px;
}

.notifications-header .mark-all-read:hover {
    background: #e5e7eb;
}

.notifications-list {
    max-height: 360px;
    overflow-y: auto;
}

.notifications-empty,
.notifications-loading {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.notifications-empty .icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background-color: #f9fafb;
}

.notification-item.unread {
    background-color: #eff6ff;
}

.notification-item.unread:hover {
    background-color: #dbeafe;
}

.notification-icon {
    font-size: 1.25rem;
    margin-right: 12px;
    flex-shrink: 0;
}

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

.notification-title {
    display: block;
    font-weight: 500;
    color: #1f2937;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-desc {
    display: block;
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-time {
    display: block;
    color: #9ca3af;
    font-size: 0.75rem;
    margin-top: 4px;
}

.notification-badge {
    margin-left: 8px;
    flex-shrink: 0;
    font-size: 0.7rem;
    padding: 2px 8px;
}

.notifications-footer {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    text-align: center;
}

.notifications-footer a {
    color: #2c75e4;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.notifications-footer a:hover {
    text-decoration: underline;
}

/* ================================================
   BARRA DE FILTROS DO DASHBOARD
   ================================================ */

.dashboard-filter-bar {
    background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1e40af;
    font-size: 0.9rem;
}

.filter-indicator .icon {
    font-size: 1rem;
}

.filter-indicator strong {
    color: #2c75e4;
}

.filter-indicator .btn-link {
    background: none;
    border: none;
    color: #1e40af;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    margin-left: 8px;
}

.filter-indicator .btn-link:hover {
    color: #2c75e4;
}

/* ================================================
   WIDGET DE PENDÊNCIAS
   ================================================ */

.widget-pendencias {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pendencia-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.pendencia-item:last-child {
    border-bottom: none;
}

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

.pendencia-titulo {
    display: block;
    font-size: 0.9rem;
    color: #1f2937;
    line-height: 1.4;
}

.pendencia-origem {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
}

.pendencias-vazio {
    text-align: center;
    padding: 30px 20px;
    color: #6b7280;
}

.pendencias-vazio .icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.pendencias-total {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

/* ================================================
   BADGES DE SEVERIDADE/STATUS
   ================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background-color: #f3f4f6;
    color: #4b5563;
}

.badge-purple {
    background-color: #ede9fe;
    color: #6b21a8;
}

.badge-icone {
    margin-right: 4px;
}

/* ================================================
   BOTÕES DO DASHBOARD
   ================================================ */

.dashboard-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dashboard-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.dashboard-actions .btn-outline {
    background: white;
    border-color: #d1d5db;
    color: #374151;
}

.dashboard-actions .btn-outline:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.dashboard-actions .btn-primary {
    background: #2c75e4;
    color: white;
}

.dashboard-actions .btn-primary:hover {
    background: #002A36;
}

.dashboard-actions .btn .icon {
    font-size: 1rem;
}

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

@media (max-width: 768px) {
    .notifications-dropdown {
        width: calc(100vw - 32px);
        right: -16px;
    }

    .dashboard-filter-bar {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .filter-indicator {
        flex-wrap: wrap;
        justify-content: center;
    }

    .dashboard-actions {
        flex-wrap: wrap;
    }

    .dashboard-actions .btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .notification-item {
        padding: 10px 12px;
    }

    .pendencia-titulo {
        font-size: 0.85rem;
    }
}

/* Mobile: Position notifications to not overlap hamburger menu */
@media (max-width: 768px) {
    .notifications-container.notifications-floating {
        right: 60px; /* Move left of hamburger menu */
        top: 8px;
    }

    /* Botões maiores e touch-friendly */
    .notifications-bell,
    .help-button {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .help-button {
        width: 44px;
        height: 44px;
    }

    /* Overlay separado para mobile */
    .notifications-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    .notifications-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Dropdown como bottom-sheet no mobile */
    .notifications-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 80vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    .notifications-dropdown.open {
        transform: translateY(0);
    }

    /* Handle visual para arrastar */
    .notifications-dropdown-handle {
        width: 36px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
        margin: 12px auto 0;
    }

    .notifications-header {
        padding: 16px 20px;
        border-radius: 0;
    }

    .notifications-header h4 {
        font-size: 1.1rem;
    }

    .notifications-list {
        max-height: calc(80vh - 140px);
        -webkit-overflow-scrolling: touch;
    }

    .notification-item {
        padding: 16px 20px;
        min-height: 72px;
        touch-action: manipulation;
    }

    .notification-title {
        font-size: 1rem;
    }

    .notification-desc {
        font-size: 0.875rem;
    }

    .notifications-footer {
        padding: 16px 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    }

    .notifications-footer a {
        display: block;
        padding: 12px;
        background: #f3f4f6;
        border-radius: 8px;
        text-align: center;
        font-size: 0.9rem;
    }
}

/* Desktop: esconder overlay */
@media (min-width: 769px) {
    .notifications-overlay,
    .notifications-dropdown-handle {
        display: none;
    }
}
