/* CRM Modülü Stilleri */
.crm-container {
    padding: 0;
    font-family: var(--font-base);
}

.crm-page-content {
    padding: 20px;
}

.crm-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.crm-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.crm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.crm-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #1E293B;
}

.crm-filter-group input,
.crm-filter-group select {
    padding: 8px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    min-width: 150px;
    font-family: inherit;
}

/* Tablo Stilleri */
.crm-table-container {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    overflow-x: auto;
}

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

.crm-table th, .crm-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.crm-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #1E293B;
    font-size: 13px;
}

.crm-table td {
    font-size: 13px;
    color: #1e293b;
}

.crm-table tr:hover {
    background: #f8fafc;
}

.crm-status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.crm-status-green { background: #22c55e; }
.crm-status-yellow { background: #eab308; }
.crm-status-red { background: #ef4444; }

/* Detay Sayfası Layout */
.crm-detail-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.crm-detail-sidebar {
    width: 320px;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    align-self: flex-start;
}

.crm-detail-main {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.crm-profile-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.crm-avatar {
    width: 80px;
    height: 80px;
    background: #3572A5;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    margin: 0 auto 10px;
}

.crm-info-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.crm-info-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 2px;
}

.crm-info-value {
    font-size: 14px;
    color: #1e293b;
    font-weight: 500;
}

/* Sekmeler */
.crm-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.crm-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
}

.crm-tab.active {
    color: #3572A5;
    border-bottom-color: #3572A5;
}

.crm-tab-content {
    display: none;
    opacity: 0;
    transition: opacity 0.18s ease;
}
.crm-tab-content.active {
    display: block;
}

/* Dashboard Cards */
.crm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.crm-stat-card {
    background: #f8fafc;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.crm-stat-title {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 5px;
}

.crm-stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #1e293b;
}

.crm-chart-container {
    height: 300px;
    width: 100%;
}

/* Ziyaret Önerisi Kartı */
.crm-visit-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-radius: 10px;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background: #64748B;
}

.crm-visit-info {
    flex: 1;
}

.crm-visit-icon {
    font-size: 40px;
    opacity: 0.8;
}

.visit-green {
    background: #10B981;
}

.visit-yellow {
    background: #F59E0B;
}

.visit-red {
    background: #EF4444;
}

/* =====================================================
   CUSTOMER HERO — Bütünleşik Müşteri Görünümü
   ===================================================== */

.customer-hero {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    background: white;
    padding: 20px 24px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.customer-avatar-lg {
    width: 56px;
    height: 56px;
    min-width: 56px;
    background: #3572A5;
    color: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.customer-hero-info {
    flex: 1;
    min-width: 0;
}

.customer-hero-name {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 800;
    color: #1E293B;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-hero-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.customer-hero-contact {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #64748b;
}

.dot-sep {
    color: #E2E8F0;
    user-select: none;
}

.customer-code-badge {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: var(--font-base);
    font-weight: 600;
    color: #1E293B;
    font-size: 12px;
}

/* Son İletişim Renk Badgeleri */
.contact-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.contact-badge-green  { background: #dcfce7; color: #15803d; }
.contact-badge-yellow { background: #fef9c3; color: #a16207; }
.contact-badge-red    { background: #fee2e2; color: #b91c1c; }
.contact-badge-unknown { background: #f1f5f9; color: #64748b; }

/* Skeleton Loader */
.skeleton-table {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px 24px;
}

.skeleton-line {
    height: 14px;
    width: 100%;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: 6px;
    margin-bottom: 12px;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dark mode uyumu */
[data-theme="dark"] .customer-hero {
    background: var(--bg-surface);
}

[data-theme="dark"] .customer-hero-name {
    color: var(--text-primary);
}

[data-theme="dark"] .customer-code-badge {
    background: #1e293b;
    color: #94a3b8;
}

[data-theme="dark"] .skeleton-table {
    background: var(--bg-surface);
}

[data-theme="dark"] .skeleton-line {
    background: linear-gradient(90deg, #1e293b 25%, #263548 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
}

/* =====================================================
   ZİYARET ROTA PLANLAMA
   ===================================================== */

.vr-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vr-card {
    background: white;
    border: 1px solid var(--border-color);
    border-left: 4px solid #94a3b8;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.15s ease;
}

.vr-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.vr-card-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.vr-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vr-musteri-adi {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    transition: color 0.15s;
}

.vr-musteri-adi:hover {
    color: #3572A5;
    text-decoration: underline;
}

.vr-badge {
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.vr-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
}

.vr-card-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    flex-wrap: wrap;
}

.vr-card-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.vr-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #1E293B;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.vr-action-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.vr-action-wa {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

.vr-action-wa:hover {
    background: #dcfce7;
    color: #166534;
}

.vr-action-activity {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #3572A5;
}

.vr-action-activity:hover {
    background: #dbeafe;
    color: #2C5282;
}

.vr-action-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Mobil uyum */
@media (max-width: 768px) {
    .customer-hero {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .customer-hero-name {
        font-size: 18px;
        white-space: normal;
    }

    .customer-hero-sub {
        font-size: 12px;
        gap: 6px;
    }

    .customer-hero-contact {
        gap: 12px;
    }

    .crm-tab {
        padding: 10px 12px;
        font-size: 12px;
    }

    #view-crm-customer-detail .crm-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .vr-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .vr-card-actions {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
    }
}
