/* =========================================
   CUSTOMERS SECTION STYLES
   ========================================= */

/* Customer Search Container - Fixed positioning */
.customer-search-container {
    display: flex;
    gap: 10px;
    align-items: stretch;
    padding: 15px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.customer-search-input {
    flex: 1;
    padding: 0 12px 0 38px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    transition: var(--transition);
    height: 40px;
    line-height: normal;
    box-sizing: border-box;
    margin: 0;
    vertical-align: middle;
}

.customer-search-input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Quick Add Button */
.quick-add-btn {
    background: #dbeafe;
    color: #1e40af;
    border: none;
    padding: 0 16px;
    border-radius: 6px;
    height: 40px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--transition);
    margin: 0;
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-add-btn:hover {
    background: #bfdbfe;
    transform: translateY(-1px);
}

/* Customer List Container */
.customer-list-container {
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

.customer-list-container::-webkit-scrollbar {
    width: 6px;
}

.customer-list-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Customer List Item */
.customer-item {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    background: white;
    border: 1px solid #e2e8f0;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    overflow: hidden;
    min-width: 0;
}

.customer-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    transform: translateX(2px);
}

.customer-item.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.customer-item-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
    margin-bottom: 4px;
}

.customer-item-details {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.customer-item.selected .customer-item-name {
    color: var(--primary);
}

/* Customer Item Links */
.customer-item a {
    transition: all 0.2s ease;
    padding: 2px 6px;
    border-radius: 4px;
}

.customer-item a:hover {
    background: #e0e7ff;
    text-decoration: underline !important;
}

/* Customer Summary View (Read-only) */
.customer-summary-view {
    padding: 10px 0;
}

.summary-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    gap: 20px;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-label {
    font-weight: 600;
    color: #64748b;
    font-size: 0.85rem;
    min-width: 140px;
    flex-shrink: 0;
}

.summary-value {
    color: #1e293b;
    font-size: 0.9rem;
    flex: 1;
    word-break: break-word;
}

.summary-value a {
    color: #3b82f6;
    text-decoration: none;
}

.summary-value a:hover {
    text-decoration: underline;
}

/* Customer Detail Box Header with Edit Button */
.customer-detail-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customer-detail-box-header > div {
    flex: 1;
}

.customer-detail-box-header button {
    flex-shrink: 0;
}

/* Customer Detail Empty State */
.customer-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    text-align: center;
    padding: 40px;
}

.customer-detail-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Customer Header */
.customer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.customer-header-title {
    margin: 0;
    font-size: 1.8rem;
    color: #1e293b;
    font-weight: 800;
}

.customer-header-id {
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Customer Detail Box (Unified Style) */
.customer-detail-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    transition: var(--transition);
}

.customer-detail-box:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Customer Detail Box Header */
.customer-detail-box-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

.customer-detail-box-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.customer-detail-box-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

/* Box Color Variants */
.customer-detail-box.contact-info .customer-detail-box-icon {
    background: #dbeafe;
    color: #0ea5e9;
}

.customer-detail-box.service-details .customer-detail-box-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.customer-detail-box.dates-info .customer-detail-box-icon {
    background: #fed7aa;
    color: #f97316;
}

.customer-detail-box.billing-info .customer-detail-box-icon {
    background: #ede9fe;
    color: #8b5cf6;
}

.customer-detail-box.notes-info .customer-detail-box-icon {
    background: #e0f2fe;
    color: #0284c7;
}

/* Customer Detail Sections */
.customer-detail-section {
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 15px;
    border-left: 4px solid;
}

.customer-detail-section.contact-info {
    background: #f0f9ff;
    border-color: #0ea5e9;
}

.customer-detail-section.service-details {
    background: #fef3c7;
    border-color: #f59e0b;
}

.customer-detail-section.dates-info {
    background: #fed7aa;
    border-color: #f97316;
}

.customer-detail-section.billing-info {
    background: #ede9fe;
    border-color: #8b5cf6;
}

.customer-detail-section.internal-notes {
    background: #f1f5f9;
    border-color: #64748b;
}

/* Customer Detail Headers */
.customer-detail-header {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.contact-info .customer-detail-header {
    color: #0369a1;
}

.service-details .customer-detail-header {
    color: #92400e;
}

.dates-info .customer-detail-header {
    color: #7c2d12;
}

.billing-info .customer-detail-header {
    color: #6d28d9;
}

.internal-notes .customer-detail-header {
    color: #334155;
}

/* Customer Detail Grid */
.customer-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.customer-detail-grid.single-column {
    grid-template-columns: 1fr;
}

/* Customer Detail Field */
.customer-detail-field {
    display: flex;
    flex-direction: column;
}

.customer-detail-field.full-width {
    grid-column: 1 / -1;
}

/* Customer Detail Labels */
.customer-detail-label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Customer Detail Inputs */
.customer-detail-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #f8fafc;
    transition: var(--transition);
}

.customer-detail-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.customer-detail-input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Textarea specific */
textarea.customer-detail-input {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Customer Action Buttons */
.customer-action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.customer-action-btn {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.customer-action-btn:hover {
    background: linear-gradient(135deg, #bfdbfe, #93c5fd);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
}

.customer-delete-btn {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.customer-delete-btn:hover {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(153, 27, 27, 0.2);
}

/* Customer Export/Import Buttons */
.customer-export-btn,
.customer-import-btn {
    background: #dbeafe;
    color: #1e40af;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
}

.customer-export-btn:hover,
.customer-import-btn:hover {
    background: #bfdbfe;
    transform: translateY(-1px);
}

/* Customer Tab Buttons */
.customer-tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.customer-tab-btn:hover {
    color: #3b82f6;
    background: #f8fafc;
}

.customer-tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: #f8fafc;
}

/* Activity Panel Styles */
#customer-activity-panel {
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
}

#customer-activity-panel::-webkit-scrollbar {
    width: 6px;
}

#customer-activity-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .customer-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .customer-header-title {
        font-size: 1.5rem;
    }
    
    #view-customers > div {
        grid-template-columns: 300px 1fr !important;
    }
}

@media (max-width: 768px) {
    #view-customers > div {
        grid-template-columns: 1fr !important;
    }
    
    #view-customers > div > div:first-child {
        display: none;
    }
    
    .customer-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .customer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .customer-header-title {
        font-size: 1.3rem;
    }
}
