/* Modern Area Manager Dashboard Styles */

:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;

    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
}

/* Dashboard Container */
.modern-solar-dashboard {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    min-height: 100vh;
}

/* Sidebar Styling */
.modern-solar-dashboard .dashboard-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    border-right: 1px solid #e2e8f0;
}

.modern-solar-dashboard .nav-item {
    margin: 8px 16px;
    padding: 12px 16px;
    border-radius: 8px;
    color: #475569;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.modern-solar-dashboard .nav-item:hover {
    background: #f1f5f9;
    color: var(--primary-color);
    transform: translateX(5px);
}

.modern-solar-dashboard .nav-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
}

.stat-card.success::before {
    background: var(--success-color);
}

.stat-card.warning::before {
    background: var(--warning-color);
}

.stat-card.danger::before {
    background: var(--danger-color);
}

.stat-card.info::before {
    background: var(--info-color);
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-5px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-card.success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-card.warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-card.danger .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.stat-card.info .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.stat-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.stat-card .stat-change {
    font-size: 14px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.chart-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* Header Enhancements */
.dashboard-header-top {
    background: var(--bg-white);
    padding: 24px 32px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;

}

.dashboard-header-top h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notification-badge {
    position: relative;
    background: var(--bg-light);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.notification-badge:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Content Cards */
.content-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
}

.content-card h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Loading Animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header-top {
        padding: 16px;
    }

    .dashboard-header-top h1 {
        font-size: 20px;
    }
}

/* Notification Panel */
.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.notification-panel.active,
.notification-panel.open {
    right: 0;
}

.notification-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Modal Specific Padding for Cleaning Services */
#schedule-visit-modal .modal-content,
#am-service-details-modal .modal-content,
#service-detail-modal .modal-content,
#service-details-modal .modal-content,
#book-cleaning-modal .modal-content,
#reset-password-modal .modal-content {
    padding: 15px !important;
}

/* Badge Styles for Team Analysis */
.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.badge-primary {
    color: #fff;
    background-color: var(--primary-color);
}

.badge-secondary {
    color: #fff;
    background-color: #6c757d;
}

.badge-success {
    color: #fff;
    background-color: var(--success-color);
}

.badge-danger {
    color: #fff;
    background-color: var(--danger-color);
}

.badge-warning {
    color: #212529;
    background-color: var(--warning-color);
}

.badge-info {
    color: #fff;
    background-color: var(--info-color);
}

.badge-light {
    color: #212529;
    background-color: #f8f9fa;
}

.badge-dark {
    color: #fff;
    background-color: #343a40;
}

/* Activity Timeline Styles (Copied from Manager Dashboard) */
.activity-timeline {
    border-left: 2px solid #e2e8f0;
    padding-left: 20px;
    margin-top: 20px;
}

.activity-item {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    position: relative;
}

.activity-item:before {
    content: '';
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    position: absolute;
    left: -27px;
    top: 18px;
}

.activity-item .activity-time {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 5px;
}

.activity-item .activity-desc {
    color: #334155;
    margin: 0;
}

/* Lead Detail Expandable Row */
.toggle-lead-details {
    outline: none;
    background: transparent;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #64748b;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.toggle-lead-details:hover {
    background-color: #f1f5f9;
    color: #334151;
}

.lead-history-container {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

/* ===================================
   CURSOR FIXES - Pointer on all clickable elements
   =================================== */

/* All buttons */
.btn,
button,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-sm,
.action-btn,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    cursor: pointer !important;
}

/* Modal close buttons and controls */
.close-modal,
.modal-close,
#close-member-modal,
#close-create-client-modal,
.close-btn,
#close-notification-panel {
    cursor: pointer !important;
}

/* Navigation and menu items */
.nav-item,
.sidebar-nav a {
    cursor: pointer !important;
}

/* View/action buttons in tables */
.view-member-detail,
.edit-btn,
.delete-btn,
.view-btn,
.remove-am-assignment,
.action-btn-danger,
.action-btn-success {
    cursor: pointer !important;
}

/* Toggles and interactive controls */
.toggle-password,
.generate-password-btn {
    cursor: pointer !important;
}

/* Table rows that are clickable */
.lead-row-clickable,
tr[data-project-id],
[data-vendor-id],
[onclick] {
    cursor: pointer !important;
}

/* General clickable indicators */
[data-toggle],
[data-dismiss],
.clickable {
    cursor: pointer !important;
}

/* Manager Dashboard Specific Overrides */
#team-analysis-section {
    margin-bottom: 20px !important;
}

.modern-solar-dashboard .content-card {
    margin-bottom: 20px;
}

/* Notification Panel */
.notification-panel {
    position: fixed;
    top: 0;
    right: -350px;
    /* Hidden by default */
    width: 320px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.notification-panel.open {
    right: 0;
    /* Shown */
}

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

.notification-header h3 {
    margin: 0;
    font-size: 18px;
    color: #334155;
}

.notification-header .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.notification-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.notification-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===================================
   MODAL STYLES (Fix for missing CSS)
   =================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Close Modal Button */
.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #1e293b;
}

/* Modal Body */
.modal-body {
    padding: 25px;
    background: #fff;
}

/* Modal Content Override for Dashboard.css interaction */
.modal-content {
    background-color: #fefefe;
    border: 1px solid #888;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    /* Dashboard.css usually handles positioning, but we ensure it here if needed */
}


/* Team Member Detail Modal */
.large-modal {
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    overflow-y: auto;
    /* Re-assert positioning if dashboard.css conflicts */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

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

.member-stat-card {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.member-stat-card h4 {
    margin: 0 0 5px 0;
    font-size: 24px;
    color: #334155;
}

.member-stat-card span {
    font-size: 13px;
    color: #64748b;
    text-transform: uppercase;
}

.activity-timeline {
    border-left: 2px solid #e2e8f0;
    padding-left: 20px;
    margin-top: 20px;
}

.activity-item {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    position: relative;
}

.activity-item:before {
    content: '';
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    position: absolute;
    left: -26px;
    top: 18px;
}

.activity-item .activity-time {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 5px;
}

.activity-item .activity-desc {
    color: #334155;
    margin: 0;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    color: #334155;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: #667eea;
    color: white;
    transition: background 0.2s;
}

.btn-sm:hover {
    background: #5568d3;
}

/* Fix for Visit Edit Modal Z-Index */
#edit-visit-modal {
    z-index: 10002 !important;
}