/* AI-Header: Contacts Page Component Styling with Light/Dark Theme Support */
/* Date: 2025-07-26 */

/* Contacts Page Container - Use default site margins */
.contacts-page-container {
    min-height: 100vh;
}

/* Contacts Grid - Consistent Card Widths */
.contacts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-start; /* Align cards to start */
}

/* Contact Card Wrapper - Fixed widths for consistency */
.contact-card-wrapper {
    flex: 0 0 calc(33.333% - 0.667rem); /* 3 cards per row, accounting for gap */
    min-width: 300px;
    max-width: 400px; /* Prevent cards from getting too wide */
}

/* Responsive breakpoints for card layout */
@media (max-width: 1200px) {
    .contact-card-wrapper {
        flex: 0 0 calc(50% - 0.5rem); /* 2 cards per row on medium screens */
    }
}

@media (max-width: 768px) {
    .contact-card-wrapper {
        flex: 0 0 100%; /* 1 card per row on mobile */
        min-width: auto;
        max-width: none;
    }
}

/* Contact Card Styling */
.contact-card {
    border: none; /* Remove all borders by default */
    border-radius: 0.5rem;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    padding: 1rem;
    width: 100%;
    text-decoration: none;
    color: inherit;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Light theme - subtle tinted cards like Figma design */
[data-bs-theme="light"] .contact-card {
    background: #f8f9fa; /* Light gray tint for unselected cards */
    color: #212529;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); /* Softer shadow for tinted background */
}

/* Dark theme - dark gray cards like Figma design */
[data-bs-theme="dark"] .contact-card {
    background: #2a2a2a; /* Dark gray background to match Figma */
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="light"] .contact-card:hover {
    background: #ffffff; /* White background on hover for selection effect */
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); /* Enhanced shadow on hover */
}

[data-bs-theme="dark"] .contact-card:hover {
    background: #3a3a3a; /* Lighter gray on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); /* Enhanced shadow for dark theme */
}

/* Horizontal lines between contact cards - remove for light theme clean look */
.contact-card-wrapper .contact-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 1px;
    background-color: transparent; /* Hidden for clean light theme */
}

/* Dark theme - keep horizontal lines */
[data-bs-theme="dark"] .contact-card-wrapper .contact-card::after {
    background-color: var(--bs-border-color);
}

.contact-card:hover::after {
    display: none; /* Hide line on hover */
}

/* Mobile optimization */
@media (max-width: 768px) {
    .contacts-grid {
        gap: 0; /* Remove vertical gap between cards */
        flex-direction: column;
    }
    
    .contact-card {
        border-radius: 0; /* Remove rounded corners on mobile */
        border: none;
        margin-bottom: 0;
        padding: 1rem 0; /* Increase padding for better touch targets */
        position: relative;
    }
    
    /* Mobile: Horizontal line after all contacts */
    .contact-card-wrapper .contact-card::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 1px;
        background-color: var(--bs-border-color);
    }
    
    .contact-card:hover {
        transform: none; /* Remove hover lift on mobile */
        box-shadow: none; /* Remove hover shadow on mobile */
        border-radius: 0; /* Keep flat on mobile */
    }
    
    .contact-card:hover::after {
        display: block; /* Keep horizontal line visible on mobile hover */
    }
}

/* Contact Avatar Styling */
.contact-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    background: var(--bs-primary);
    color: white;
    flex-shrink: 0;
}

/* Contact Information Layout */
.contact-info {
    flex: 1;
    min-width: 0; /* Allows text truncation */
}

.contact-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

/* Light and dark theme text colors */
[data-bs-theme="light"] .contact-name {
    color: #212529; /* Strong dark text for readability */
}

[data-bs-theme="dark"] .contact-name {
    color: #ffffff; /* White text for burgundy background */
}

.contact-business {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

[data-bs-theme="light"] .contact-business {
    color: #6c757d; /* Muted gray for secondary text */
}

[data-bs-theme="dark"] .contact-business {
    color: rgba(255, 255, 255, 0.8); /* Light text for burgundy background */
}

.contact-business .company-name {
    font-weight: 500;
}

.contact-business .job-title {
    font-style: italic;
}

/* Contact Method Icons */
.contact-methods {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.contact-method-icon {
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}

/* Contact method icons theme colors */
[data-bs-theme="light"] .contact-method-icon {
    color: #6c757d; /* Muted gray icons for clean look */
}

[data-bs-theme="dark"] .contact-method-icon {
    color: rgba(255, 255, 255, 0.7); /* Light icons for burgundy background */
}

[data-bs-theme="light"] .contact-method-icon:hover {
    opacity: 1;
    color: #495057; /* Darker gray on hover */
}

[data-bs-theme="dark"] .contact-method-icon:hover {
    opacity: 1;
    color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="light"] .contact-method-icon.phone {
    color: #198754; /* Green phone icon */
}

[data-bs-theme="dark"] .contact-method-icon.phone {
    color: #90ee90; /* Light green for dark background */
}

[data-bs-theme="light"] .contact-method-icon.email {
    color: #0d6efd; /* Blue email icon */
}

[data-bs-theme="dark"] .contact-method-icon.email {
    color: #87ceeb; /* Light blue for dark background */
}

.contact-method-icon.facebook {
    color: #1877f2;
}

.contact-method-icon.twitter {
    color: #1da1f2;
}

.contact-method-icon.linkedin {
    color: #0077b5;
}

/* Contact Actions */
.contact-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-type-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
    background: none !important;
    border: none !important;
    color: #6c757d !important;
}

/* Shared sync icon styling */
.contact-card .contact-type-badge {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    background-color: rgba(0, 123, 255, 0.1);
    border-radius: 0.25rem;
}

.contact-card .contact-type-badge i {
    font-size: 1.2rem;
    opacity: 1;
    color: #007bff;
}

[data-bs-theme="dark"] .contact-card .contact-type-badge {
    background-color: rgba(13, 110, 253, 0.2);
}

[data-bs-theme="dark"] .contact-card .contact-type-badge i {
    color: #0d6efd;
}

/* Loading State */
.contact-skeleton {
    padding: 0.75rem 0;
}

.contact-skeleton .skeleton-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

[data-bs-theme="dark"] .contact-skeleton .skeleton-avatar {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-line {
    height: 1rem;
    border-radius: 0.25rem;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

[data-bs-theme="dark"] .skeleton-line {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .contact-card {
        margin-bottom: 0 !important; /* Force remove any vertical margin */
        padding: 1rem 0 !important; /* Consistent padding */
    }
    
    .contact-methods {
        flex-wrap: wrap;
    }
    
    .contact-actions {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--bs-border-color);
    }
    
    .contact-actions .btn-group {
        width: 100%;
    }
}

/* Empty State */
.contacts-empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.contacts-empty-state .empty-icon {
    font-size: 5rem;
    opacity: 0.3;
    color: var(--bs-secondary-color);
    margin-bottom: 2rem;
}
