/* CRM Admin Styles */

.motors-crm-wrap {
    margin: 20px 20px 20px 0;
}

.crm-stats-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    border-left: 4px solid #0073aa;
}

.stat-card.status-new { border-left-color: #00a0d2; }
.stat-card.status-contacted { border-left-color: #826eb4; }
.stat-card.status-qualified { border-left-color: #f18500; }
.stat-card.status-negotiating { border-left-color: #ffc107; }
.stat-card.status-won { border-left-color: #46b450; }
.stat-card.status-lost { border-left-color: #dc3232; }

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #23282d;
}

.crm-filters {
    background: #fff;
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-form select,
.filter-form input[type="search"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-new { background: #e3f2fd; color: #1976d2; }
.status-badge.status-contacted { background: #f3e5f5; color: #7b1fa2; }
.status-badge.status-qualified { background: #fff3e0; color: #e65100; }
.status-badge.status-negotiating { background: #fff9c4; color: #f57f17; }
.status-badge.status-closed_won { background: #e8f5e9; color: #2e7d32; }
.status-badge.status-closed_lost { background: #ffebee; color: #c62828; }

/* Inquiry Detail */

.inquiry-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-top: 20px;
}

.info-card {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.info-card h2,
.info-card h3 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.info-table th {
    text-align: left;
    padding: 10px;
    width: 150px;
    color: #666;
    font-weight: 600;
}

.info-table td {
    padding: 10px;
}

.info-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.message-box {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
}

.seller-info {
    border-left: 4px solid #ffc107;
}

.inquiry-sidebar {
    position: sticky;
    top: 32px;
}

.action-card {
    background: #fff;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.action-card h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    text-transform: uppercase;
    color: #666;
}

.action-card .button {
    margin-top: 10px;
}

.close-deal {
    border-left: 4px solid #46b450;
}

/* Modal */

.modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    overflow-y: auto;
}

.modal-content {
    background: #fff;
    margin: 50px auto;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-content.large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    font-size: 28px;
    border: none;
    background: none;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.modal-close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.commission-calc {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.commission-calc h4 {
    margin: 0 0 10px 0;
}

.commission-calc table {
    width: 100%;
}

.commission-calc th,
.commission-calc td {
    padding: 8px;
    text-align: left;
}

.commission-calc tr {
    border-bottom: 1px solid #ddd;
}

@media (max-width: 1200px) {
    .inquiry-grid {
        grid-template-columns: 1fr;
    }
    
    .inquiry-sidebar {
        position: static;
    }
}

@media (max-width: 782px) {
    .crm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ==========================================
   MOBILE & RESPONSIVE ENHANCEMENTS
   ========================================== */

/* Matching Dashboard Mobile */
@media (max-width: 1024px) {
    .matching-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .crm-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .motors-matching-wrap h1 {
        font-size: 1.5rem;
    }
    
    .crm-stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .wp-list-table {
        font-size: 0.875rem;
    }
    
    .wp-list-table th,
    .wp-list-table td {
        padding: 0.5rem;
    }
    
    /* Stack table on mobile */
    .wp-list-table thead {
        display: none;
    }
    
    .wp-list-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
    
    .wp-list-table td {
        display: block;
        text-align: right;
        padding: 0.5rem;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .wp-list-table td:before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #666;
    }
}

/* Chart Container */
.chart-container {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 1.5rem 0;
}

.chart-container h3 {
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 1.5rem 0;
}

@media (max-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* Simple ASCII Charts (No external libs needed) */
.ascii-chart {
    font-family: monospace;
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
    gap: 0.5rem;
}

.chart-label {
    min-width: 100px;
    font-weight: 600;
}

.chart-bar-fill {
    height: 24px;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0.5rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Performance Indicators */
.performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.performance-card {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.performance-card.hot {
    border-left-color: #46b450;
}

.performance-card.good {
    border-left-color: #f18500;
}

.performance-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: #666;
}

.performance-card .value {
    font-size: 2rem;
    font-weight: bold;
    color: #23282d;
}

.performance-card .trend {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

.trend.up {
    color: #46b450;
}

.trend.down {
    color: #dc3232;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.notice-large {
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid;
    border-radius: 4px;
}

.notice-large.notice-success {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.notice-large.notice-info {
    background: #d1ecf1;
    border-left-color: #0c5460;
    color: #0c5460;
}

/* Touch-friendly buttons on mobile */
@media (max-width: 640px) {
    .button,
    .button-primary,
    .button-large {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        min-height: 44px;
    }
}

/* Jitsi Call Card */
.jitsi-call-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left: none !important;
}

.jitsi-call-card h2 {
    color: white;
}

.jitsi-call-card .dashicons {
    color: white;
}

.active-meeting,
.no-meeting {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.meeting-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #46b450;
    animation: pulse 2s infinite;
}

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

.meeting-info {
    margin: 1rem 0;
    color: rgba(255, 255, 255, 0.9);
}

.meeting-actions .button-primary {
    background: white;
    color: #667eea;
    border: none;
    font-weight: 600;
    padding: 0.75rem 2rem;
}

.meeting-actions .button-primary:hover {
    background: #f0f0f0;
    color: #764ba2;
}

.meeting-link {
    font-family: monospace;
    font-size: 0.85em;
}

.meeting-history {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 4px;
}

.meeting-history h3 {
    color: white;
}

.meeting-history table {
    background: rgba(255, 255, 255, 0.1);
}

.meeting-history th,
.meeting-history td {
    color: white !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
