/* User Management Styles */
.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.users-header h2 {
    font-size: 2.5rem;
    font-weight: 300;
    color: #333333;
    margin: 0;
    letter-spacing: -0.025em;
}

.users-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.users-stat-card {
    background: white;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
}

.users-stat-card:hover {
    border-color: #e0e0e0;
    transform: translateY(-2px);
}

.users-stat-card .stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 300;
    color: #333333;
    margin-bottom: 0.5rem;
}

.users-stat-card .stat-label {
    font-size: 0.9rem;
    color: #666666;
    font-weight: 400;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.user-card {
    background: white;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.2s ease;
    position: relative;
}

.user-card:hover {
    border-color: #e0e0e0;
    transform: translateY(-4px);
}

.user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 500;
    color: #666666;
    margin-bottom: 1.5rem;
}

.user-info {
    margin-bottom: 1.5rem;
}

.user-name {
    font-size: 1.25rem;
    font-weight: 500;
    color: #333333;
    margin: 0 0 0.5rem 0;
}

.user-email {
    font-size: 0.9rem;
    color: #666666;
    margin: 0 0 1rem 0;
}

.user-role-badge {
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
    letter-spacing: 0.025em;
}

.role-admin {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.role-agent {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

.role-viewer {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.user-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #fafafa;
    border-radius: 8px;
}

.user-stats .stat {
    text-align: center;
}

.user-stats .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 500;
    color: #333333;
    margin-bottom: 0.25rem;
}

.user-stats .stat-label {
    font-size: 0.8rem;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.users-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #888888;
}

.users-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cccccc;
}

.users-empty h3 {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: #666666;
}

.users-empty p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.user-details-modal {
    max-width: 500px;
    width: 100%;
}

.user-details-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.user-details-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 500;
    color: #666666;
}

.user-details-header h3 {
    font-size: 1.5rem;
    font-weight: 500;
    color: #333333;
    margin: 0 0 0.5rem 0;
}

.user-details-header p {
    font-size: 0.9rem;
    color: #666666;
    margin: 0 0 0.75rem 0;
}

.user-details-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.detail-stat {
    text-align: center;
    padding: 1.5rem;
    background: #fafafa;
    border-radius: 8px;
}

.detail-stat .stat-number {
    display: block;
    font-size: 1.75rem;
    font-weight: 300;
    color: #333333;
    margin-bottom: 0.5rem;
}

.detail-stat .stat-label {
    font-size: 0.8rem;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-tickets h4 {
    font-size: 1.125rem;
    font-weight: 500;
    color: #333333;
    margin-bottom: 1rem;
}

.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ticket-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #fafafa;
    border-radius: 6px;
}

.ticket-item .ticket-id {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    color: #666666;
    font-weight: 500;
    min-width: 40px;
}

.ticket-item .ticket-title {
    flex: 1;
    font-size: 0.9rem;
    color: #333333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.more-tickets {
    font-size: 0.85rem;
    color: #666666;
    text-align: center;
    margin-top: 0.75rem;
    font-style: italic;
}

/* Analytics Styles */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.analytics-header h2 {
    font-size: 2.5rem;
    font-weight: 300;
    color: #333333;
    margin: 0;
    letter-spacing: -0.025em;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-placeholder {
    height: 300px;
    background: #fafafa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888888;
    font-size: 0.9rem;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

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

.notification.success {
    border-left: 4px solid #16a34a;
}

.notification.error {
    border-left: 4px solid #dc2626;
}

.notification.warning {
    border-left: 4px solid #d97706;
}

.notification.info {
    border-left: 4px solid #0284c7;
}

.notification-icon {
    font-size: 1.125rem;
}

.notification.success .notification-icon {
    color: #16a34a;
}

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

.notification.warning .notification-icon {
    color: #d97706;
}

.notification.info .notification-icon {
    color: #0284c7;
}

.notification-message {
    flex: 1;
    font-size: 0.9rem;
    color: #333333;
}

.notification-close {
    background: none;
    border: none;
    color: #888888;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
}

.notification-close:hover {
    color: #333333;
}

/* Notification Bell */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-right: 15px;
}

.notification-bell:hover {
    background: rgba(0, 0, 0, 0.1);
}

.notification-bell i {
    font-size: 20px;
    color: #666;
}

.notification-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.notification-count.hidden {
    display: none;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid #e5e7eb;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-height: 400px;
    overflow: hidden;
    pointer-events: auto;
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.mark-all-read {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mark-all-read:hover {
    background: #f3f4f6;
}

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

.notification-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    width: 8px;
    height: 8px;
    background: #ffc107;
    border-radius: 50%;
    transform: translateY(-50%);
}

.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    pointer-events: none;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.notification-icon.ticket-created {
    background: #dbeafe;
    color: #1d4ed8;
}

.notification-icon.ticket-updated {
    background: #fef3c7;
    color: #d97706;
}

.notification-icon.ticket-assigned {
    background: #fef3c7;
    color: #d97706;
}

.notification-icon.ticket-resolved {
    background: #dcfce7;
    color: #16a34a;
}

.notification-icon.user-created {
    background: #e0e7ff;
    color: #4338ca;
}

.notification-details {
    flex: 1;
}

.notification-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 2px;
}

.notification-message {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: #9ca3af;
}

.no-notifications {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.no-notifications i {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.no-notifications p {
    margin: 0;
    font-size: 14px;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading .loading-spinner {
    margin-right: 0.5rem;
}

/* Tooltip */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333333;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 0.5rem;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333333;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* Comments Section */
.comments-section {
    margin-top: 2rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1.5rem;
}

.comments-section h4 {
    margin: 0 0 1rem 0;
    color: #374151;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comments-section h4::before {
    content: "💬";
    font-size: 1.2rem;
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    min-height: 120px;
}

.comments-list:empty::before {
    content: "No comments yet. Add the first comment below.";
    color: #9ca3af;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    text-align: center;
}

.comment-item {
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
}

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

.comment-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.comment-item.internal {
    background: #fefbf3;
    border-color: #fbbf24;
    border-left: 4px solid #f59e0b;
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-header strong {
    color: #374151;
    font-weight: 600;
    font-size: 0.9rem;
}

.comment-time {
    color: #9ca3af;
    font-size: 0.8rem;
    font-weight: 400;
}

.internal-badge {
    background: #fbbf24;
    color: #78350f;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comment-text {
    color: #4b5563;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.add-comment {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 1rem;
}

.add-comment textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.add-comment textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.add-comment textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.comment-actions {
    display: flex;
    justify-content: flex-end; 
    align-items: center;
    margin-top: 0.75rem;
}

.comment-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-options label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}

.comment-options input[type="checkbox"] {
    margin: 0;
    transform: scale(0.9);
}

#add-comment-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    flex-shrink: 0;
}

#add-comment-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.comments-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: #9ca3af;
    font-style: italic;
}

.comments-loading::before {
    content: "⏳";
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.no-comments {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: #9ca3af;
    font-style: italic;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .users-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .chart-container {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .users-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    
    .users-header h2 {
        font-size: 2rem;
    }
    
    .users-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .users-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .user-card {
        padding: 1.5rem;
    }
    
    .user-details-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .notification {
        min-width: 280px;
        right: 10px;
        top: 10px;
    }
    
    .notification-dropdown {
        width: 300px;
        right: -50px;
    }
    
    .comments-section {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
    
    .comments-list {
        max-height: 250px;
        padding: 0.5rem;
    }
    
    .comment-item {
        padding: 0.75rem;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .comment-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .comment-options {
        justify-content: center;
    }
    
    #add-comment-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .users-stats {
        grid-template-columns: 1fr;
    }
    
    .user-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .user-details-header {
        flex-direction: column;
        text-align: center;
    }
    
    .detail-stat {
        padding: 1rem;
    }
    
    .chart-container {
        padding: 1.5rem;
    }
    
    .analytics-header h2 {
        font-size: 1.75rem;
    }
}