* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --dark-bg: #121212; --sidebar-bg: #1A1A1A; --light-bg: #F4F7FA;
    --accent-color: #D4AF37; --text-main: #1C1C1C;
    --text-muted: #6B6B6B; --border-color: #EAEAEA;
    --success: #10B981; --warning: #F59E0B; --danger: #EF4444; --info: #3B82F6;
}

/* Səhifə sığortası: Horizontal scroll bloklanır */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body { font-family: 'Poppins', sans-serif; background-color: var(--light-bg); color: var(--text-main); display: flex; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
button { font-family: 'Poppins', sans-serif; cursor: pointer; outline: none; transition: 0.3s; }

/* ========================================= */
/* MAIN CONTENT & HEADER                    */
/* ========================================= */
.main-content { 
    flex: 1; 
    margin-left: 280px; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh;
    width: calc(100% - 280px);
}

.top-header { 
    background: #fff; 
    padding: 20px 40px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--border-color); 
    position: sticky; 
    top: 0; 
    z-index: 50; 
}

.search-bar { display: flex; align-items: center; background: var(--light-bg); padding: 10px 20px; border-radius: 8px; width: 350px; gap: 10px; }
.search-bar input { border: none; background: transparent; font-family: 'Poppins', sans-serif; font-size: 14px; width: 100%; outline: none; }

.admin-profile { display: flex; align-items: center; gap: 15px; }
.profile-info { text-align: right; }
.profile-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.profile-role { font-size: 12px; color: var(--text-muted); }
.profile-img { width: 45px; height: 45px; border-radius: 12px; background: var(--dark-bg); color: var(--accent-color); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }

.dashboard-container { padding: 40px; position: relative; width: 100%; }

/* ========================================= */
/* MÜŞTƏRİLƏR SƏHİFƏSİ XÜSUSİ DİZAYNI        */
/* ========================================= */
.page-header-flex { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 30px; gap: 15px; }
.page-title { font-size: 26px; font-weight: 700; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 5px; }

/* DÜYMƏLƏRİN MƏCBURİ BƏRPASI */
.btn-primary { 
    background-color: var(--dark-bg) !important; 
    color: #fff !important; 
    border: none !important; 
    padding: 12px 24px !important; 
    border-radius: 8px !important; 
    font-size: 13px !important; 
    font-weight: 600 !important; 
    display: inline-flex !important; 
    align-items: center !important; 
    gap: 8px !important;
    white-space: nowrap;
}
.btn-primary:hover { background-color: var(--accent-color) !important; transform: translateY(-2px); }

/* Mini Statistika */
.crm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.crm-stat-card { background: #fff; padding: 20px 25px; border-radius: 16px; border: 1px solid var(--border-color); display: flex; align-items: center; gap: 20px; transition: 0.3s; }
.crm-stat-card:hover { transform: translateY(-3px); border-color: var(--accent-color); }
.crm-icon { width: 50px; height: 50px; border-radius: 12px; background: rgba(212, 175, 55, 0.1); color: var(--accent-color); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.crm-stat-info h4 { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; margin-bottom: 5px; }
.crm-stat-info div { font-size: 24px; font-weight: 700; color: var(--text-main); }

/* Cədvəl Sığortası */
.table-section { background: #fff; border-radius: 16px; border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0,0,0,0.02); overflow: hidden; width: 100%; }
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 950px; }
th { text-align: left; padding: 18px 25px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border-color); background: var(--light-bg); }
td { padding: 18px 25px; font-size: 14px; color: var(--text-main); border-bottom: 1px solid var(--border-color); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFAFA; }

.customer-cell { display: flex; align-items: center; gap: 15px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--light-bg); color: var(--dark-bg); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; border: 1px solid var(--border-color); flex-shrink: 0; }
.avatar.vip { background: rgba(212, 175, 55, 0.1); color: var(--accent-color); border-color: rgba(212, 175, 55, 0.3); }

.segment-badge { padding: 5px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.segment-vip { background: var(--dark-bg); color: var(--accent-color); }
.segment-standard { background: var(--light-bg); color: var(--text-muted); border: 1px solid var(--border-color); }

.ltv-col { font-weight: 700; color: var(--success); }

.btn-view { 
    background-color: var(--light-bg) !important; 
    border: 1px solid var(--border-color) !important; 
    color: var(--text-main) !important; 
    padding: 8px 12px !important; 
    border-radius: 6px !important; 
    font-size: 12px !important; 
    font-weight: 600 !important; 
    display: inline-flex !important; 
    align-items: center !important; 
    gap: 5px !important; 
}
.btn-view:hover { background-color: var(--dark-bg) !important; color: #fff !important; }

/* ========================================= */
/* MÜŞTƏRİ PROFİLİ MODALI                    */
/* ========================================= */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 1000; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: 0.3s; padding: 15px; }
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-content { background: #fff; width: 100%; max-width: 800px; border-radius: 20px; overflow: hidden; transform: translateY(20px); transition: 0.3s; max-height: 90vh; display: flex; flex-direction: column; }
.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-header { padding: 30px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: flex-start; background: var(--light-bg); gap: 15px; }
.profile-header-info { display: flex; gap: 20px; align-items: center; }
.profile-avatar { width: 70px; height: 70px; border-radius: 50%; background: var(--dark-bg); color: var(--accent-color); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; border: 2px solid var(--accent-color); flex-shrink: 0; }
.profile-title h2 { font-size: 22px; margin-bottom: 5px; display: flex; align-items: center; gap: 10px; }
.profile-title p { color: var(--text-muted); font-size: 14px; display: flex; gap: 15px; }

.btn-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 5px; font-size: 24px; }

.modal-body { padding: 30px; overflow-y: auto; flex: 1; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.info-card { border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; }
.info-card h4 { font-size: 13px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }

.history-list { border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border-color); gap: 10px; }

/* ========================================= */
/* 📱 MEDIA QUERIES (FULL RESPONSIVE)        */
/* ========================================= */

@media (max-width: 1200px) {
    .main-content { margin-left: 0; width: 100%; }
    .top-header { padding: 15px 25px; }
}

@media (max-width: 992px) {
    .crm-stats { grid-template-columns: repeat(2, 1fr); }
    .profile-info { display: none; }
}

@media (max-width: 768px) {
    /* Header Mobil Optimizasiyası */
    .top-header { flex-wrap: wrap; padding: 10px 15px; gap: 10px; }
    .search-bar { order: 3; width: 100%; display: flex !important; }
    .admin-profile { order: 2; gap: 10px; }

    .dashboard-container { padding: 20px 15px; }
    .page-header-flex { flex-direction: column; align-items: flex-start; }
    .btn-primary { width: 100%; justify-content: center; }

    /* Statistika tək sütun */
    .crm-stats { grid-template-columns: 1fr; }
    
    /* Modal Mobil */
    .profile-grid { grid-template-columns: 1fr; }
    .profile-header-info { flex-direction: column; align-items: flex-start; }
    .profile-title p { flex-direction: column; gap: 5px; }
    .modal-header { padding: 20px; }
    .modal-body { padding: 20px; }
}

@media (max-width: 480px) {
    .page-title { font-size: 20px; }
    .crm-stat-info div { font-size: 20px; }
    .profile-img { width: 35px; height: 35px; font-size: 14px; }
    
    .history-item { flex-direction: column; align-items: flex-start; }
    .history-price { margin-top: 5px; }
}