/**
 * JobDash Digital - Notification System Styles
 * v2.3.0
 *
 * Toast Notifications + Notification Center
 */

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    z-index: var(--z-tooltip, 1070);
    pointer-events: none;
    padding: var(--spacing-md, 1rem);

    /* Desktop: bottom-right */
    bottom: 80px; /* Acima do footer */
    right: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.5rem);
    max-width: 400px;
    width: 100%;
}

/* Mobile: top center */
@media (max-width: 640px) {
    .toast-container {
        top: 70px; /* Abaixo do header */
        bottom: auto;
        right: 0;
        left: 0;
        max-width: 100%;
        align-items: center;
    }
}

.toast {
    pointer-events: auto;
    background-color: var(--bg-secondary, #2d2d2d);
    border-radius: var(--radius-lg, 8px);
    box-shadow: var(--shadow-xl, 0 8px 15px rgba(0, 0, 0, 0.2));
    padding: var(--spacing-md, 1rem) var(--spacing-lg, 1.5rem);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md, 1rem);
    min-width: 280px;
    max-width: 380px;
    border-left: 4px solid var(--accent, #3498db);

    /* Animation */
    animation: toast-slide-in 0.3s ease forwards;
    transform: translateX(100%);
    opacity: 0;
}

@media (max-width: 640px) {
    .toast {
        min-width: auto;
        max-width: calc(100% - 2rem);
        width: calc(100% - 2rem);
        transform: translateY(-100%);
    }
}

/* Toast types */
.toast--success {
    border-left-color: var(--success, #2ecc71);
}

.toast--error {
    border-left-color: var(--error, #e74c3c);
}

.toast--warning {
    border-left-color: var(--warning, #f1c40f);
}

.toast--info {
    border-left-color: var(--info, #17a2b8);
}

/* Toast icon */
.toast__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast--success .toast__icon { color: var(--success, #2ecc71); }
.toast--error .toast__icon { color: var(--error, #e74c3c); }
.toast--warning .toast__icon { color: var(--warning, #f1c40f); }
.toast--info .toast__icon { color: var(--info, #17a2b8); }

/* Toast content */
.toast__content {
    flex: 1;
    min-width: 0;
}

.toast__title {
    font-weight: var(--font-weight-semibold, 600);
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-primary, #ffffff);
    margin: 0 0 4px 0;
}

.toast__message {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-secondary, #b3b3b3);
    margin: 0;
    line-height: var(--line-height-normal, 1.5);
}

/* Toast close button */
.toast__close {
    background: none;
    border: none;
    color: var(--text-secondary, #b3b3b3);
    cursor: pointer;
    padding: 4px;
    margin: -4px -4px -4px 0;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity var(--transition-fast, 0.15s ease);
    flex-shrink: 0;
}

.toast__close:hover {
    opacity: 1;
    color: var(--text-primary, #ffffff);
}

/* Toast progress bar */
.toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: var(--accent, #3498db);
    border-radius: 0 0 0 var(--radius-lg, 8px);
    animation: toast-progress linear forwards;
}

.toast--success .toast__progress { background-color: var(--success, #2ecc71); }
.toast--error .toast__progress { background-color: var(--error, #e74c3c); }
.toast--warning .toast__progress { background-color: var(--warning, #f1c40f); }
.toast--info .toast__progress { background-color: var(--info, #17a2b8); }

/* Animations */
@keyframes toast-slide-in {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 640px) {
    @keyframes toast-slide-in {
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@media (max-width: 640px) {
    @keyframes toast-slide-out {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(-100%);
            opacity: 0;
        }
    }
}

@keyframes toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

.toast--removing {
    animation: toast-slide-out 0.3s ease forwards;
}

/* ========================================
   NOTIFICATION CENTER (Header Bell)
   ======================================== */

.notification-center {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notification-bell {
    background: none;
    border: none;
    color: var(--text-secondary, #b3b3b3);
    cursor: pointer;
    padding: var(--spacing-sm, 0.5rem);
    font-size: 1.125rem;
    position: relative;
    transition: color var(--transition-fast, 0.15s ease);
}

.notification-bell:hover {
    color: var(--text-primary, #ffffff);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--error, #e74c3c);
    color: white;
    font-size: 0.625rem;
    font-weight: var(--font-weight-bold, 700);
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full, 9999px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-badge:empty,
.notification-badge[data-count="0"] {
    display: none;
}

/* Notification dropdown */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 400px;
    background-color: var(--bg-secondary, #2d2d2d);
    border-radius: var(--radius-lg, 8px);
    box-shadow: var(--shadow-xl, 0 8px 15px rgba(0, 0, 0, 0.2));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    z-index: var(--z-dropdown, 1000);
    display: none;
    overflow: hidden;
}

.notification-dropdown.is-open {
    display: block;
    animation: dropdown-fade-in 0.2s ease;
}

@keyframes dropdown-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dropdown header */
.notification-dropdown__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md, 1rem);
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.notification-dropdown__title {
    font-weight: var(--font-weight-semibold, 600);
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-primary, #ffffff);
    margin: 0;
}

.notification-dropdown__mark-all {
    background: none;
    border: none;
    color: var(--accent, #3498db);
    font-size: var(--font-size-xs, 0.75rem);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm, 4px);
    transition: background-color var(--transition-fast, 0.15s ease);
}

.notification-dropdown__mark-all:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

/* Notification list */
.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: var(--spacing-sm, 0.5rem);
    padding: var(--spacing-md, 1rem);
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    cursor: pointer;
    transition: background-color var(--transition-fast, 0.15s ease);
}

.notification-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

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

.notification-item--unread {
    background-color: rgba(52, 152, 219, 0.05);
}

.notification-item--unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--accent, #3498db);
}

.notification-item__icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--text-secondary, #b3b3b3);
}

.notification-item--success .notification-item__icon { color: var(--success, #2ecc71); }
.notification-item--error .notification-item__icon { color: var(--error, #e74c3c); }
.notification-item--warning .notification-item__icon { color: var(--warning, #f1c40f); }
.notification-item--info .notification-item__icon { color: var(--info, #17a2b8); }

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

.notification-item__title {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-primary, #ffffff);
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item__message {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-secondary, #b3b3b3);
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item__time {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-secondary, #b3b3b3);
    opacity: 0.7;
}

/* Empty state */
.notification-empty {
    padding: var(--spacing-xl, 2rem);
    text-align: center;
    color: var(--text-secondary, #b3b3b3);
}

.notification-empty__icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm, 0.5rem);
    opacity: 0.5;
}

.notification-empty__text {
    font-size: var(--font-size-sm, 0.875rem);
}

/* Dropdown footer */
.notification-dropdown__footer {
    padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    text-align: center;
}

.notification-dropdown__view-all {
    color: var(--accent, #3498db);
    font-size: var(--font-size-sm, 0.875rem);
    text-decoration: none;
}

.notification-dropdown__view-all:hover {
    text-decoration: underline;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .notification-dropdown {
        position: fixed;
        top: 60px;
        right: var(--spacing-sm, 0.5rem);
        left: var(--spacing-sm, 0.5rem);
        width: auto;
        max-height: calc(100vh - 140px);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast--removing,
    .notification-dropdown.is-open {
        animation: none;
        transform: none;
        opacity: 1;
    }

    .toast__progress {
        animation: none;
        width: 0;
    }
}
