/**
 * Styles principaux - Application Carte Commerciale
 * Design moderne et professionnel
 */

/* ==================== Variables ==================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.2s ease;
    --navbar-height: 64px;
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
}

/* ==================== Login Page ==================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.login-logo i {
    font-size: 32px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 13px;
}

.login-form label i {
    color: var(--text-muted);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-form input::placeholder {
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* ==================== Alerts ==================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

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

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

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

.btn-success:hover:not(:disabled) {
    background: #16a34a;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
}

.btn-text:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-icon {
    padding: 10px;
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* ==================== Map Page ==================== */
.map-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Navbar */
.navbar {
    height: var(--navbar-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    color: var(--primary);
}

.navbar-brand i {
    font-size: 22px;
}

.navbar-search {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.navbar-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.navbar-search input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.navbar-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-item .result-name {
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-item .result-type {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.search-result-item .result-address {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.search-no-results {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
}

/* Map */
#map {
    flex: 1;
    width: 100%;
}

/* Map Legend */
.map-legend {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 50;
}

.legend-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary);
    transition: var(--transition);
}

.legend-toggle:hover {
    background: var(--bg-secondary);
}

.legend-content {
    position: absolute;
    bottom: 54px;
    left: 0;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    min-width: 200px;
    display: none;
}

.map-legend.active .legend-content {
    display: block;
}

.legend-content h4 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    margin-top: 12px;
}

.legend-content h4:first-child {
    margin-top: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Active Filters Bar */
.active-filters {
    position: fixed;
    top: calc(var(--navbar-height) + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 50;
    max-width: 90%;
    flex-wrap: wrap;
}

.active-filters-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

#activeFiltersList {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.filter-tag button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.filter-tag button:hover {
    color: var(--danger);
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loader.hidden {
    display: none;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader p {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==================== Modals ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-filters {
    max-width: 600px;
}

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

.modal-edit {
    max-width: 550px;
}

.modal-route {
    max-width: 700px;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Filter Modal Specifics */
.filter-section {
    margin-bottom: 24px;
}

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

.filter-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-scrollable {
    max-height: 150px;
    overflow-y: auto;
    padding-right: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.checkbox-label:hover {
    background: var(--bg-tertiary);
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkbox-label input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.label-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Details Modal */
.detail-header {
    margin-bottom: 20px;
}

.detail-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.detail-header .detail-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.detail-type.client {
    background: #dbeafe;
    color: #1d4ed8;
}

.detail-type.prospect {
    background: #ffedd5;
    color: #c2410c;
}

.detail-type.resilie {
    background: #fee2e2;
    color: #dc2626;
}

.detail-address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-address i {
    color: var(--text-muted);
    margin-top: 2px;
}

.members-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.member-item:hover {
    background: var(--bg-tertiary);
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 500;
    color: var(--text-primary);
}

.member-role {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.member-contact {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.member-contact a {
    color: var(--primary);
    text-decoration: none;
}

.member-contact a:hover {
    text-decoration: underline;
}

.member-edit {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.member-edit:hover {
    background: white;
    color: var(--primary);
}

/* Edit Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.form-row .form-group {
    margin-bottom: 16px;
}

.input-readonly {
    background: var(--bg-secondary) !important;
    color: var(--text-muted) !important;
}

/* Route Modal */
.route-info {
    padding: 12px 16px;
    background: #eff6ff;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #1d4ed8;
}

.route-list {
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.route-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.route-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
}

.route-item-number {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.route-item-info {
    flex: 1;
}

.route-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.route-item-address {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.route-item-remove {
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.route-item-remove:hover {
    background: #fee2e2;
    color: var(--danger);
}

.route-stats {
    display: flex;
    gap: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-top: 16px;
}

.route-stats .stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.route-stats .stat i {
    color: var(--primary);
}

.modal-footer-route {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.route-actions-left,
.route-actions-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: '';
    margin-left: 8px;
    border: 4px solid transparent;
    border-top-color: currentColor;
    display: inline-block;
    vertical-align: middle;
}

.dropdown-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: 8px 0;
    display: none;
    margin-bottom: 4px;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 13px;
}

.dropdown-menu a:hover {
    background: var(--bg-secondary);
}

.dropdown-menu a i {
    width: 16px;
    color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    min-width: 280px;
}

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

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

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

.toast-success .toast-icon {
    background: #dcfce7;
    color: var(--success);
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: var(--danger);
}

.toast-info .toast-icon {
    background: #dbeafe;
    color: var(--primary);
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

/* InfoWindow Custom Styles */
.gm-style-iw {
    padding: 0 !important;
}

.gm-style-iw-d {
    overflow: auto !important;
    max-height: none !important;
}

.info-window {
    padding: 16px;
    min-width: 250px;
}

.info-window h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.info-window p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.info-window .info-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 8px;
}

.info-window .btn {
    margin-top: 12px;
    width: 100%;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .navbar {
        padding: 0 12px;
        gap: 12px;
    }
    
    .navbar-brand span {
        display: none;
    }
    
    .navbar-search {
        max-width: none;
    }
    
    .navbar-actions .btn span {
        display: none;
    }
    
    .modal-content {
        max-width: none;
        margin: 0;
        border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
        max-height: 85vh;
    }
    
    .modal {
        align-items: flex-end;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .route-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer-route {
        flex-direction: column;
        gap: 12px;
    }
    
    .route-actions-left,
    .route-actions-right {
        width: 100%;
    }
    
    .route-actions-left .btn,
    .route-actions-right .btn {
        flex: 1;
    }
}

/* ==================== Navigation Links ==================== */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-link i {
    font-size: 14px;
}

/* ==================== Dashboard Page ==================== */
.dashboard-page {
    min-height: 100vh;
    background: var(--bg-secondary);
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

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

.kpi-clients { border-left-color: #2563eb; }
.kpi-prospects { border-left-color: #FF5722; }
.kpi-resilies { border-left-color: #F44336; }
.kpi-total { border-left-color: #22c55e; }

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.kpi-clients .kpi-icon { background: #dbeafe; color: #2563eb; }
.kpi-prospects .kpi-icon { background: #ffedd5; color: #FF5722; }
.kpi-resilies .kpi-icon { background: #fee2e2; color: #F44336; }
.kpi-total .kpi-icon { background: #dcfce7; color: #22c55e; }

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.charts-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.chart-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.chart-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-header h3 i {
    color: var(--primary);
    font-size: 14px;
}

.chart-body {
    padding: 20px;
    height: 280px;
    position: relative;
}

.chart-body-tall {
    height: 350px;
}

/* Modifications Table */
.modifications-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.modifications-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.modifications-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modifications-header h3 i {
    color: var(--primary);
}

.date-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.date-group input[type="date"] {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
}

.date-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
}

.modifications-body {
    overflow-x: auto;
}

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

.modifications-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.modifications-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.modifications-table tbody tr:hover {
    background: var(--bg-secondary);
}

.modifications-table tbody td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
}

.date-cell {
    white-space: nowrap;
    color: var(--text-secondary) !important;
    font-size: 12px !important;
}

.name-cell {
    font-weight: 500;
}

.loading-cell, .empty-cell {
    text-align: center;
    padding: 30px !important;
    color: var(--text-muted) !important;
}

.type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.type-badge.client {
    background: #dbeafe;
    color: #1d4ed8;
}

.type-badge.prospect {
    background: #ffedd5;
    color: #c2410c;
}

.type-badge.resilie {
    background: #fee2e2;
    color: #dc2626;
}

.source-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    margin-left: 6px;
}

/* ==================== City Search ==================== */
.city-search-wrapper {
    position: relative;
}

.city-search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    margin-top: 4px;
    display: none;
    z-index: 1000;
}

.city-search-dropdown.active {
    display: block;
}

.city-search-dropdown input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
}

.city-search-dropdown input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.city-search-results {
    margin-top: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.city-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 13px;
    color: var(--text-primary);
}

.city-result-item:hover {
    background: var(--bg-secondary);
}

.city-result-item i {
    color: var(--primary);
    flex-shrink: 0;
}

.city-no-result {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==================== Prospect Load Button ==================== */
.btn-prospect-load {
    background: #FF5722;
    color: white;
    transition: var(--transition);
}

.btn-prospect-load:hover {
    background: #E64A19;
    transform: scale(1.03);
}

.btn-prospect-load:active {
    transform: scale(0.97);
}

/* ==================== Dashboard Responsive ==================== */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
    .charts-grid .chart-card:last-child {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid,
    .charts-grid-2 {
        grid-template-columns: 1fr;
    }
    
    .charts-grid .chart-card:last-child {
        grid-column: span 1;
    }
    
    .modifications-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .date-filters {
        width: 100%;
    }
    
    .navbar-nav .nav-link span {
        display: none;
    }
    
    .navbar-actions .btn span {
        display: none;
    }
    
    .city-search-dropdown {
        width: 280px;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-container {
        padding: 12px;
    }
    
    .date-filters {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==================== Locate Me Button ==================== */
.btn-locate {
    background: #2563eb;
    color: white;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 16px;
    box-shadow: var(--shadow);
}
.btn-locate:hover {
    background: #1d4ed8;
    transform: scale(1.1);
}

/* ==================== Comment in Details ==================== */
.detail-comment {
    margin: 16px 0;
    padding: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--border-radius);
}
.detail-comment-label {
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 6px;
}
.detail-comment-text {
    font-size: 13px;
    color: #78350f;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Textarea in edit form */
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    resize: vertical;
    min-height: 60px;
}
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Mobile nav link - visible only on mobile */
.nav-link-mobile {
    display: none;
}
@media (max-width: 768px) {
    .nav-link-mobile {
        display: flex;
    }
}
