/* Customer CRM & Loyalty System Styles */

/* CRM Controls */
.crm-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.search-box input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.filter-group {
    display: flex;
    gap: 12px;
}

.filter-group select {
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* Customer Cards Grid */
.customer-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.customer-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.customer-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.customer-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
}

.customer-avatar {
    font-size: 48px;
    color: #667eea;
}

.customer-basic-info {
    flex: 1;
}

.customer-basic-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #2c3e50;
}

.customer-tier {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    color: white;
}

.customer-status {
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.customer-status.status-active {
    background: #d4edda;
    color: #155724;
}

.customer-status.status-at-risk {
    background: #fff3cd;
    color: #856404;
}

.customer-status.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.customer-contact {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

.customer-contact div {
    margin-bottom: 4px;
}

.customer-contact i {
    width: 16px;
    margin-right: 8px;
    color: #999;
}

.customer-metrics {
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin-bottom: 12px;
}

.customer-metrics .metric {
    text-align: center;
    font-size: 13px;
}

.customer-metrics .metric i {
    display: block;
    font-size: 18px;
    margin-bottom: 4px;
    color: #667eea;
}

.customer-last-visit {
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* Customer Profile Modal */
.modal-large {
    max-width: 1000px;
}

.customer-profile {
    display: flex;
    gap: 24px;
}

.profile-sidebar {
    width: 280px;
    text-align: center;
}

.profile-avatar {
    font-size: 100px;
    color: #667eea;
    margin-bottom: 16px;
}

.profile-sidebar h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
}

.profile-contact {
    text-align: left;
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
}

.profile-contact div {
    margin-bottom: 8px;
}

.profile-contact div:last-child {
    margin-bottom: 0;
}

.profile-contact i {
    width: 20px;
    margin-right: 8px;
    color: #667eea;
}

.btn-block {
    width: 100%;
    margin-bottom: 12px;
}

.profile-main {
    flex: 1;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.profile-stat {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.profile-stat h3 {
    margin: 0;
    font-size: 28px;
}

.profile-stat p {
    margin: 8px 0 4px 0;
    font-size: 14px;
    opacity: 0.9;
}

.profile-stat small {
    font-size: 12px;
    opacity: 0.8;
}

/* Profile Tabs */
.profile-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #eee;
    margin-bottom: 24px;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Purchase History */
.purchase-history {
    max-height: 400px;
    overflow-y: auto;
}

.purchase-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
}

.purchase-date {
    font-weight: 600;
    color: #2c3e50;
}

.purchase-items {
    flex: 1;
    color: #666;
}

.purchase-total {
    font-weight: 700;
    color: #28a745;
    font-size: 16px;
}

/* Notes Section */
.notes-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 12px;
}

.notes-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 24px;
}

.note-item {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #667eea;
}

.note-item.system-note {
    border-left-color: #28a745;
    background: #d4edda;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.note-date {
    font-size: 12px;
    color: #999;
}

.system-badge {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.note-message {
    font-size: 14px;
    color: #2c3e50;
}

.empty-notes {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Rewards Section */
.rewards-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.tier-progress-card,
.referral-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
}

.tier-progress-card h4,
.referral-card h4 {
    margin: 0 0 16px 0;
}

.progress-bar-container {
    margin-top: 16px;
}

.progress-bar {
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.progress-bar-container p {
    text-align: center;
    font-size: 13px;
    color: #666;
}

.referral-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.points-earned {
    color: #28a745;
    font-weight: 600;
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.analytics-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
}

.analytics-card h4 {
    margin: 0 0 16px 0;
}

.analytics-item,
.pattern-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.analytics-item:last-child,
.pattern-item:last-child {
    border-bottom: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    color: #ddd;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    color: #666;
}

.empty-state p {
    margin-bottom: 24px;
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: -400px;
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transition: right 0.3s ease;
    z-index: 10000;
}

.notification.show {
    right: 20px;
}

.notification-success {
    border-left: 4px solid #28a745;
}

.notification-info {
    border-left: 4px solid #17a2b8;
}

.notification i {
    font-size: 24px;
}

.notification-success i {
    color: #28a745;
}

.notification-info i {
    color: #17a2b8;
}

/* Stat Card Variations */
.stat-card.stat-gold {
    background: linear-gradient(135deg, #f7b731 0%, #f79f1f 100%);
}

.stat-card.stat-warning {
    background: linear-gradient(135deg, #ffa502 0%, #ff6348 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .customer-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .crm-controls {
        flex-direction: column;
    }
    
    .filter-group {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-group select {
        width: 100%;
    }
    
    .customer-profile {
        flex-direction: column;
    }
    
    .profile-sidebar {
        width: 100%;
    }
    
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rewards-section,
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}
