/* Import color system */
@import url('colors.css');

/*
    Modern Notification System Styles
*/

/* Base notification styles */
#msgNotifyHome {
    font: 87.5%/1.5em 'Open Sans', sans-serif;
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}

.notification-container > * {
    pointer-events: auto;
    margin-bottom: 12px;
}

/* Enhanced Alert Styles */
.alert_bs {
    border: none !important;
    margin: 0;
    font-size: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.modern-notification {
    padding: 16px;
    min-height: 72px;
    animation: slideInRight 0.3s ease-out;
}

.modern-notification::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
    opacity: 0.8;
}

.notification-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    margin-right: 12px;
    flex-shrink: 0;
}

.notification-icon .fa {
    font-size: 1.25rem;
    color: currentColor;
}

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

.notification-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    line-height: 1.2;
}

.notification-message {
    font-size: 0.875rem;
    opacity: 0.9;
    line-height: 1.3;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    background: none;
    color: currentColor;
    opacity: 0.7;
    padding: 8px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.notification-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Toast Notifications */
.toast-notification {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
    min-height: 72px;
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

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

.toast-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    color: #333;
}

.toast-message {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.3;
}

.toast-close {
    border: none;
    background: none;
    color: #999;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #333;
    background: #f0f0f0;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    background: currentColor;
    opacity: 0.6;
    animation: progressBar linear forwards;
    transform-origin: left;
}

/* Banner Notifications */
.banner-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slideInDown 0.3s ease-out;
    min-height: 56px;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    width: 100%;
}

.banner-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.banner-text {
    flex-grow: 1;
    min-width: 0;
}

.banner-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.banner-message {
    font-size: 0.875rem;
    opacity: 0.9;
}

.banner-close {
    border: none;
    background: none;
    color: currentColor;
    opacity: 0.8;
    padding: 8px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.banner-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* Color Variants */
.alert[data-type="info"], .toast-info .toast-icon, .banner-info {
    background: var(--alert-info-bg, #3498db);
    color: var(--white, #ffffff) !important;
}

.alert[data-type="warning"], .toast-warning .toast-icon, .banner-warning {
    background: var(--alert-warning-bg, #f39c12);
    color: var(--text-dark, #333333) !important;
}

.alert[data-type="danger"], .toast-danger .toast-icon, .banner-danger {
    background: var(--alert-danger-bg, #e74c3c);
    color: var(--white, #ffffff) !important;
}

.alert[data-type="success"], .toast-success .toast-icon, .banner-success {
    background: var(--alert-success-bg, #27ae60);
    color: var(--white, #ffffff) !important;
}

/* Legacy Alert Positions */
#msgAlertLogin {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    margin-left: auto; 
    margin-right: auto; 
    z-index: 9999;
}

#msgNotifyHome {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    margin-left: auto; 
    margin-right: auto; 
    z-index: 9999;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes progressBar {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .modern-notification {
        font-size: 0.9rem;
        min-height: 64px;
        padding: 12px;
    }
    
    .notification-icon {
        width: 32px;
        height: 32px;
        margin-right: 8px;
    }
    
    .notification-icon .fa {
        font-size: 1rem;
    }
    
    .banner-notification {
        padding: 10px 15px;
        min-height: 48px;
    }
    
    .banner-content {
        gap: 8px;
    }
    
    .banner-icon {
        width: 24px;
        height: 24px;
    }
    
    .banner-title {
        font-size: 0.9rem;
    }
    
    .banner-message {
        font-size: 0.8rem;
    }
    
    .toast-notification {
        margin: 0 10px 12px 10px;
        padding: 12px;
        min-height: 60px;
    }
    
    .toast-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .notification-container {
        top: 5px;
        right: 5px;
        left: 5px;
    }
    
    .banner-content {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
    
    .banner-title,
    .banner-message {
        text-align: center;
    }
}

/* Notification badge in navbar - keep fully visible (no clipping). No !important on display so JS can hide when count is 0. */
.notification-badge-nav {
    top: 2px !important;
    right: -6px !important;
    left: auto !important;
    transform: none !important;
    font-size: 0.65rem;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    line-height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Notification Dropdown - compact, no white strip */
.notification-dropdown {
    min-width: 320px;
    max-width: 380px;
    border: 1px solid var(--border-color, #dee2e6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: var(--bs-primary, #0d6efd);
    color: #fff;
    padding: 10px 12px;
    margin: 0;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.notification-dropdown-title {
    white-space: nowrap;
}

.notification-dropdown-mark-all {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none !important;
    padding: 2px 6px !important;
    font-size: 0.75rem !important;
    white-space: nowrap;
    border: none !important;
    background: none !important;
}

.notification-dropdown-mark-all:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 4px;
}

.notification-list {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-primary, #fff);
    border-bottom: 1px solid var(--border-color, #eee);
}

.notification-list .notification-list-empty {
    padding: 16px 12px;
    font-size: 0.85rem;
}

.notification-list .notification-list-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color, #eee);
    white-space: normal;
    cursor: pointer;
    transition: background-color 0.15s ease;
    background: var(--bg-primary, #fff);
}

.notification-list .notification-list-item:hover {
    background-color: var(--bg-secondary, #f8f9fa);
}

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

.notification-list .notification-list-item.unread {
    background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.08);
    border-left: 3px solid var(--bs-primary, #0d6efd);
    margin-left: 0;
    padding-left: 12px;
}

.notification-dropdown-footer {
    padding: 8px 12px;
    background: var(--bg-secondary, #f8f9fa);
    border-top: 1px solid var(--border-color, #eee);
    flex-shrink: 0;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.notification-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 0.75rem;
}

.notification-item-icon.success {
    background: #198754;
}

.notification-item-icon.info,
.notification-item-icon.message {
    background: var(--bs-primary, #0d6efd);
}

.notification-item-icon.warning {
    background: #fd7e14;
}

.notification-item-icon.danger,
.notification-item-icon.error {
    background: #dc3545;
}

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

.notification-item-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary, #212529);
    margin-bottom: 2px;
    line-height: 1.25;
}

.notification-item-message {
    font-size: 0.8rem;
    color: var(--text-secondary, #6c757d);
    line-height: 1.3;
    margin-bottom: 2px;
}

.notification-item-time {
    font-size: 0.7rem;
    color: var(--text-muted, #6c757d);
}

/* Legacy badge helper */
.notification-badge {
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile adjustments for notification dropdown */
@media (max-width: 768px) {
    .notification-dropdown {
        min-width: 280px;
        max-width: calc(100vw - 24px);
        margin-right: 8px;
    }
    
    .notification-dropdown-header {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .notification-list {
        max-height: 240px;
    }
    
    .notification-item-title {
        font-size: 0.8rem;
    }
    
    .notification-item-message {
        font-size: 0.75rem;
    }
    
    .notification-item-icon {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
    
    .notification-badge-nav {
        font-size: 0.6rem;
        min-width: 14px;
        height: 14px;
        line-height: 14px;
    }
}

/* User Management Styles */
.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-stats-card {
    transition: transform 0.2s ease;
}

.user-stats-card:hover {
    transform: translateY(-2px);
}

.password-requirements {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 8px;
    border-left: 3px solid #dee2e6;
}

.password-requirements .text-success {
    color: #198754 !important;
}

.password-requirements .text-danger {
    color: #dc3545 !important;
}

.password-requirements ul {
    margin-bottom: 0;
    font-size: 0.8rem;
}

.password-requirements li {
    padding: 2px 0;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.btn-group .btn {
    border-radius: 0.375rem !important;
    margin-right: 2px;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

.users-table-container {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.375rem;
    overflow: hidden;
}

.user-role-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.user-status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.user-avatar {
    font-weight: 600;
    text-transform: uppercase;
}

/* Mobile responsive for user management */
@media (max-width: 768px) {
    .user-stats-row .col-md-3 {
        margin-bottom: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin-bottom: 2px;
        margin-right: 0;
        border-radius: 0.375rem !important;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .avatar-sm {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
}