/* Agent Details Modal Styles */
#agent-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #121212;
    display: none;
    padding: 20px;
    color: white;
    z-index: 1000;
}

#agent-details-modal.show {
    display: block;
}

/* Agent Details Content */
.agent-details-content {
    padding: 20px;
    max-width: 500px;
    margin: 20px auto;
    background-color: #f9f9f9;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    text-align: center;
}

.agent-details-header-container {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid #4CAF50;
}

.back-arrow {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 15px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.back-arrow:hover {
    background-color: rgba(76, 175, 80, 0.1);
}

/* Dark mode back arrow hover */
body.dark-mode .back-arrow:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.back-arrow svg {
    width: 24px;
    height: 24px;
    fill: #4CAF50;
}

/* Dark mode back arrow */
body.dark-mode .back-arrow svg {
    fill: #ffffff;
}

/* Chart container styles for performance pie chart */
.chart-container {
    position: relative;
    margin: auto;
    height: 60vw;
    width: 60vw;
    max-width: 250px;
    max-height: 250px;
    margin-top: 20px;
}

/* Notification Modal Base Styles */
.notification-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: 1000;
    overflow-y: auto;
}

.notification-modal.show {
    display: block;
}

.notification-modal-content-wrapper {
    position: absolute;
    top: 50%;
    left: 45%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 500px;
    padding: 20px;
    box-sizing: border-box;
}

.notification-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4CAF50;
}

/* Bulk messaging modal: remove the long green divider for a cleaner, centered look */
#bulk-messaging-modal .notification-modal-header {
    border-bottom: none;
    padding-bottom: 0;
}

.notification-modal-header h3 {
    margin: 0;
    color: #4CAF50;
    text-align: center;
    font-size: 24px;
    flex-grow: 1;
}

.back-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #4CAF50;
    padding: 5px;
}

/* Dark mode support for notification modal */
body.dark-mode .notification-modal {
    background-color: #121212;
    color: #ffffff;
}

body.dark-mode .notification-modal-header h3 {
    color: #4CAF50;
}

body.dark-mode .back-button {
    color: #4CAF50;
}

/* Performance modal specific styles */
#performance-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    padding: 20px;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: 1002;
    max-width: 100%;
    overflow-y: auto;
}

#performance-modal.show {
    display: block;
}

#performance-modal .notification-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4CAF50;
}

#performance-modal .notification-modal-header h3 {
    margin: 0;
    color: #4CAF50;
    text-align: center;
    font-size: 24px;
    flex-grow: 1;
}

#performance-modal .back-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #4CAF50;
    padding: 5px;
}

.time-period-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.time-period-button {
    padding: 10px 15px;
    background-color: #f1f1f1;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.time-period-button.active {
    background-color: #4CAF50;
    color: white;
}

.performance-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.performance-stat-card {
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.performance-stat-card h4 {
    margin: 0 0 10px 0;
    color: #4CAF50;
}

.performance-stat-card p {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

/* Added space at the bottom of performance modal */
.performance-footer {
    height: 40px; /* Added space at the bottom */
    margin-top: 20px;
}

/* Dark mode support for performance modal */
body.dark-mode #performance-modal {
    background-color: #121212;
    border-color: #333;
    color: #ffffff;
}

body.dark-mode .time-period-button {
    background-color: #333;
    color: #ffffff;
}

body.dark-mode .time-period-button.active {
    background-color: #4CAF50;
    color: #ffffff;
}

body.dark-mode .performance-stat-card {
    background-color: #333;
}

.agent-details-header {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0;
    color: #4CAF50;
    text-align: center;
    flex-grow: 1;
}

.agent-profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: #e0e0e0;
    margin: 0 auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #4CAF50;
}

.agent-profile-avatar svg {
    width: 60px;
    height: 60px;
    fill: #4CAF50;
}

#agent-details-name {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0 0 20px 0;
    color: #333;
}

.agent-info-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.agent-info-list li {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    padding: 12px 0;
    border-bottom: 1px solid #4CAF50;
}

.agent-info-list li:last-child {
    border-bottom: none;
}

.agent-info-list .info-icon {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    fill: #4CAF50;
}

.agent-info-list .info-text {
    color: #555;
}

/* Dark Mode Agent Details */
body.dark-mode .agent-details-content {
    background-color: #2a2a2a;
    border: 1px solid #444;
}
body.dark-mode #agent-details-name {
    color: #ffffff;
}
body.dark-mode .agent-profile-avatar {
    background-color: #444;
    border-color: #4CAF50;
}
body.dark-mode .agent-profile-avatar svg {
    fill: #4CAF50;
}
body.dark-mode .agent-info-list li {
    border-bottom-color: #555;
}
body.dark-mode .agent-info-list .info-icon {
    fill: #4CAF50;
}
body.dark-mode .agent-info-list .info-text {
    color: #ccc;
}
body.dark-mode #agent-details-modal p {
  color: #ccc;
}

/* Close button for agent details modal */
.close-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

.close-button:hover {
    background-color: #45a049;
}

body.dark-mode .close-button {
    background-color: #4CAF50;
    color: white;
}

body.dark-mode .close-button:hover {
    background-color: #45a049;
}

/* Countdown Timer Styles */
.countdown-container {
    margin: 10px 0;
    padding: 8px 12px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 6px;
    border-left: 3px solid #4CAF50;
}

.countdown-timer {
    font-weight: bold;
    font-size: 1.1em;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Dark mode countdown styles */
body.dark-mode .countdown-container {
    background-color: rgba(76, 175, 80, 0.15);
    border-left-color: #4CAF50;
}

body.dark-mode .countdown-timer {
    color: #4CAF50;
}

/* Countdown urgency colors */
.countdown-timer.urgent {
    color: #ff8800;
    animation: pulse 1s infinite;
}

.countdown-timer.critical {
    color: #ff4444;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Payment Status Styles */
.payment-status {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
}

.payment-status.paid {
    background-color: #4CAF50;
    color: white;
}

.payment-status.failed {
    background-color: #f44336;
    color: white;
}

.payment-status.pending {
    background-color: #ff9800;
    color: white;
}

/* Countdown Timer Styles for Customer Cards */
.countdown-container {
    margin-top: 4px;
    font-size: 0.85em;
}

.countdown-timer {
    color: #4CAF50;
    font-weight: bold;
    font-size: 0.9em;
}

.countdown-timer.critical {
    color: #ff4444;
    animation: pulse 0.5s infinite;
}

/* Service Status Item Layout */
.service-status-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 8px;
    padding: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.service-status-item .service-number,
.service-status-item .service-name {
    font-size: 0.9em;
    margin-bottom: 2px;
}

.service-status-item .payment-status {
    margin-bottom: 2px;
}

/* Bulk Messaging Modal Styles - Consistent with existing design */
.bulk-messaging-content {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    max-width: 500px;
    margin: 0 auto;
    box-sizing: border-box;
    width: 100%;
}

.message-type-section {
    margin-bottom: 20px;
}

.message-type-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.message-type-section select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.recipients-section {
    margin-bottom: 20px;
}

.recipients-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 1.1rem;
}

/* Professional Filter System - Mobile Optimized */
.filter-controls {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    flex: 1;
    min-width: 140px;
}

.filter-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #495057;
    font-size: 11px;
}

.filter-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 12px;
    background-color: white;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.filter-group select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Professional Summary Cards - Mobile Optimized */
.recipient-summary {
    margin-bottom: 15px;
}

.summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 80px;
    padding: 8px 12px; /* add padding to prevent content from touching edges */
    width: 100%;
    box-sizing: border-box;
}

.summary-label {
    font-size: 9px;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 16px;
    font-weight: bold;
    color: #cfe9d1; /* softer, less saturated green to avoid harsh edge */
    font-family: 'Courier New', monospace;
}

/* Professional Quick Selection Buttons - Mobile Optimized */
.quick-selection {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.quick-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex: 1;
    min-width: 100px;
}

.quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.active-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.overdue-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
}

.service-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.clear-btn {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
}

.message-composition {
    margin-bottom: 15px;
}

.message-composition label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.message-composition textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.character-count {
    text-align: right;
    font-size: 10px;
    color: #666;
    margin-top: 4px;
}

.message-templates {
    margin-bottom: 15px;
}

.message-templates label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.template-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.template-btn {
    padding: 8px 12px;
    border: 1px solid #4CAF50;
    background-color: white;
    color: #4CAF50;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s;
    flex: 1;
    min-width: 80px;
}

.template-btn:hover {
    background-color: #4CAF50;
    color: white;
}

.send-section {
    margin-bottom: 15px;
    text-align: center;
}

.send-bulk-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 150px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 260px;
}

.send-bulk-btn:hover {
    background-color: #45a049;
}

.send-bulk-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.bulk-progress {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background-color: #4CAF50;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-weight: bold;
    color: #333;
}

.bulk-results {
    margin-top: 20px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bulk-results h4 {
    margin-top: 0;
    color: #333;
}

.results-summary {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

.results-summary.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.results-summary.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.results-details {
    max-height: 200px;
    overflow-y: auto;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    background-color: white;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.result-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.result-status.sent {
    background-color: #d4edda;
    color: #155724;
}

.result-status.failed {
    background-color: #f8d7da;
    color: #721c24;
}

/* Dark mode styles for bulk messaging - Professional dark theme */
body.dark-mode .bulk-messaging-content {
    background-color: #121212;
    color: #ffffff;
}

body.dark-mode .message-type-section label,
body.dark-mode .recipients-section label,
body.dark-mode .message-composition label,
body.dark-mode .message-templates label {
    color: #ffffff;
}

body.dark-mode .message-type-section select,
body.dark-mode .message-composition textarea {
    background-color: #2d2d2d;
    border-color: #444;
    color: #ffffff;
}

/* Dark mode filter controls */
body.dark-mode .filter-controls {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #444;
}

body.dark-mode .filter-group label {
    color: #e0e0e0;
}

body.dark-mode .filter-group select {
    background-color: #2d2d2d;
    border-color: #444;
    color: #ffffff;
}

body.dark-mode .filter-group select:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Dark mode summary cards */
body.dark-mode .summary-card {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #444;
}

body.dark-mode .summary-label {
    color: #b0b0b0;
}

body.dark-mode .summary-value {
    color: #b7e2bb; /* match softer green in dark mode */
}

/* Dark mode quick buttons */
body.dark-mode .quick-btn {
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-mode .quick-btn:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

body.dark-mode .bulk-results {
    background-color: #2d2d2d;
    border-color: #444;
}

body.dark-mode .result-item {
    background-color: #1a1a1a;
    border-color: #444;
    color: #ffffff;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .bulk-messaging-content {
        padding: 15px;
        box-sizing: border-box;
    }
    
    .notification-modal-content-wrapper {
        max-width: 95%;
        padding: 15px;
    }
    
    .notification-modal {
        padding: 0;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .summary-card {
        flex-direction: column;
        gap: 10px;
    }
    
    .summary-item {
        min-width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px; /* increased right padding to prevent numbers from touching edge */
        background-color: rgba(255, 255, 255, 0.06); /* neutral, no green tint */
        border-radius: 6px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .summary-label {
        font-size: 10px;
        margin-bottom: 0;
    }
    
    .summary-value {
        font-size: 14px;
        margin-right: 4px; /* add small margin to prevent touching edge */
    }
    
    .quick-selection {
        flex-direction: column;
        gap: 8px;
    }
    
    .quick-btn {
        width: 100%;
        padding: 10px;
        font-size: 12px;
    }
    
    .template-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .template-btn {
        width: 100%;
        padding: 10px;
        font-size: 12px;
    }
    
    .send-bulk-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .filter-controls {
        padding: 8px;
    }
    
    .filter-group label {
        font-size: 10px;
    }
    
    .filter-group select {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .summary-card {
        padding: 8px;
    }
    
    .summary-label {
        font-size: 9px;
    }
    
    .summary-value {
        font-size: 12px;
    }
    
    .quick-btn {
        padding: 8px;
        font-size: 10px;
    }
    
    .template-btn {
        padding: 8px;
        font-size: 10px;
    }
    
    .message-composition textarea {
        min-height: 60px;
        padding: 8px;
        font-size: 13px;
    }
    
    .character-count {
        font-size: 9px;
    }
}
