/* JD Directory Analytics Dashboard CSS */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 0;
}
.container-fluid {
    padding: 20px;
}
.analytics-header {
    background-color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.analytics-header h1 {
    margin: 0;
    font-size: 24px;
    color: #367c2b; /* John Deere Green */
}
.card {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 20px;
}
.card-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    color: #555;
}
.stat-card {
    text-align: center;
    padding: 20px;
    border-radius: 4px;
    color: #fff;
    margin-bottom: 20px;
}
.stat-value {
    font-size: 32px;
    font-weight: bold;
}
.stat-label {
    font-size: 14px;
    opacity: 0.9;
}
.bg-primary { background-color: #367c2b; }
.bg-info { background-color: #5bc0de; }
.bg-warning { background-color: #f0ad4e; }
.bg-danger { background-color: #d9534f; }

/* Tabs - Improved Spacing */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.tab {
    padding: 12px 24px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
    min-width: 140px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tab:hover {
    background: #e9ecef;
    border-color: #367c2b;
    color: #367c2b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(54, 124, 43, 0.2);
}
.tab.active {
    background: #367c2b;
    color: white;
    border-color: #367c2b;
    box-shadow: 0 4px 8px rgba(54, 124, 43, 0.3);
    font-weight: 600;
}
.tab i {
    margin-right: 8px;
}
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}
.tab-content.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}
tr:hover {
    background-color: #f5f5f5;
}
.status-success { color: #367c2b; font-weight: bold; }
.status-error { color: #d9534f; font-weight: bold; }
.status-warning { color: #f0ad4e; font-weight: bold; }

/* Filters */
.filters {
    background-color: #fff;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
select, input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    height: 38px; /* Fixed height to ensure text fits */
    line-height: normal;
    box-sizing: border-box;
    vertical-align: middle;
}
button {
    padding: 8px 15px;
    background-color: #367c2b;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
button:hover {
    background-color: #2a6221;
}
button.secondary {
    background-color: #6c757d;
}
button.secondary:hover {
    background-color: #5a6268;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Badges */
.badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    background-color: #eee;
    color: #333;
}
.badge-success { background-color: #dff0d8; color: #3c763d; }
.badge-error { background-color: #f2dede; color: #a94442; }
.badge-info { background-color: #d9edf7; color: #31708f; }

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #777;
}
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #367c2b;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Category Cards */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.category-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    cursor: pointer;
    transition: all 0.3s ease;
    border-top: 4px solid #367c2b;
    position: relative;
    overflow: hidden;
}
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-top-color: #2a6221;
}
.category-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}
.category-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}
.category-stat {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.2s;
}
.category-card:hover .category-stat {
    background: #e9ecef;
}
.category-stat-value {
    font-weight: bold;
    font-size: 18px;
    color: #367c2b;
    margin-bottom: 5px;
}
.category-stat-value.status-success {
    color: #28a745;
}
.category-stat-value.status-warning {
    color: #ffc107;
}
.category-stat-value.status-error {
    color: #dc3545;
}
.category-stat-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}
.category-footer {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    margin: 15px -25px -25px -25px;
    padding: 12px 25px;
}

/* Enhanced Dealer Employee Categories */
.category-card[data-category*="Dealer Employee"] {
    border-top-color: #17a2b8;
}
.category-card[data-category*="Dealer Employee"]:hover {
    border-top-color: #138496;
}

/* Different colors for different API types */
.category-card[data-category*="Search"] {
    border-top-color: #6610f2;
}
.category-card[data-category*="Report"] {
    border-top-color: #fd7e14;
}
.category-card[data-category*="Admin"] {
    border-top-color: #e83e8c;
}
.category-card[data-category*="Training"] {
    border-top-color: #20c997;
}

/* Simple View Styles */
.simple-view-container {
    max-width: 1400px;
    margin: 0 auto;
}

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

.simple-stat-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
    border-bottom: 3px solid #ddd;
    transition: all 0.3s ease;
}

.simple-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.simple-stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
    margin: 5px 0;
}

.simple-stat-label {
    font-size: 13px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.simple-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.simple-category-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.simple-category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.simple-category-title {
    font-size: 16px;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.simple-category-value {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

.simple-category-subtitle {
    font-size: 12px;
    color: #95a5a6;
    margin-bottom: 15px;
}

.simple-category-users {
    font-size: 13px;
    color: #34495e;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
}

.simple-section-title {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.simple-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 30px;
}

.simple-table {
    width: 100%;
    border-collapse: collapse;
}

.simple-table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid #eee;
}

.simple-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    color: #34495e;
}

.simple-table tr:last-child td {
    border-bottom: none;
}

.simple-table tr:hover {
    background-color: #f8f9fa;
}

.detail-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.detail-btn:hover {
    background: #2980b9;
}

.pagination-btn {
    background: white;
    border: 1px solid #ddd;
    color: #333;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: #f1f1f1;
}

.pagination-btn.active {
    background: #367c2b;
    color: white;
    border-color: #367c2b;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chart-toggle-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 5px;
}

.chart-toggle-btn.active {
    background: #367c2b;
    color: white;
    border-color: #367c2b;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

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

/* User Metrics Styles */
.user-search-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.user-search-section h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.user-search-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.user-search-input-group {
    flex: 1;
    min-width: 250px;
}

.user-search-input-group label {
    display: block;
    color: white;
    margin-bottom: 8px;
    font-weight: 500;
}

.user-search-input-group input,
.user-search-input-group select {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-search-btn {
    padding: 12px 30px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
}

.user-search-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.user-search-btn i {
    margin-right: 8px;
}

.user-metrics-empty {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.user-metrics-empty i {
    font-size: 5em;
    margin-bottom: 20px;
    opacity: 0.3;
    color: #667eea;
}

.user-metrics-empty h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.user-profile-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.user-profile-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 25px;
}

.user-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2em;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.user-info h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 1.8em;
}

.user-info p {
    margin: 0;
    color: #7f8c8d;
    font-size: 1.1em;
}

.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.user-stat-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.user-stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.user-stat-value {
    font-size: 2.2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.user-stat-label {
    color: #7f8c8d;
    font-size: 0.95em;
    font-weight: 500;
}

.user-activity-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Clickable User Rows in User Summary */
.clickable-user-row {
    cursor: pointer;
    transition: all 0.2s;
}

.clickable-user-row:hover {
    background: #e3f2fd !important;
    transform: translateX(5px);
    box-shadow: -4px 0 0 #667eea;
}

.user-id-link {
    color: #667eea;
    font-weight: bold;
    text-decoration: none;
}

.user-id-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* User Dropdown Styles */
.user-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    margin-top: -6px;
}

.user-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.user-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.user-dropdown-item:hover {
    background: #f8f9ff;
}

.user-dropdown-item.selected {
    background: #e8ecff;
    font-weight: bold;
}

.user-dropdown-user-id {
    font-weight: 600;
    color: #667eea;
}

.user-dropdown-actions {
    font-size: 0.85em;
    color: #7f8c8d;
}

.user-dropdown-empty {
    padding: 20px;
    text-align: center;
    color: #999;
}

/* Responsive Design for Tabs and User Metrics */
@media (max-width: 768px) {
    .tabs {
        gap: 5px;
        padding: 10px;
    }
    
    .tab {
        padding: 10px 16px;
        min-width: 110px;
        font-size: 0.9em;
    }
    
    .user-search-container {
        flex-direction: column;
    }
    
    .user-profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .user-activity-charts {
        grid-template-columns: 1fr;
    }
}


