#dashboard-section {
    display: flex;
    flex-direction: column;
    background-color: #f8fafc;
}

.dashboard-header {
    background-color: var(--card-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.logo-small {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.dashboard-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-bar {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-bar input {
    padding-left: 2.75rem;
    background-color: white;
    border-radius: 2rem;
}

.view-toggle {
    display: flex;
    background-color: white;
    border-radius: 0.5rem;
    padding: 0.25rem;
    box-shadow: var(--shadow-sm);
}

.view-toggle .btn-icon {
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
}

.view-toggle .btn-icon.active {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

/* Grid Layout (Card View) */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.contacts-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Contact Card Styles */
.contact-card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: visible;
    /* Changed for dropdown */
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure full height in grid */
}

.contact-card.favorite {
    background-color: #eff6ff;
    /* Light blue */
    border-color: #bfdbfe;
}

.list-view .contact-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.5rem;
    gap: 1.5rem;
    flex-wrap: nowrap;
}

.list-left-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    min-width: 0;
}

.list-info-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1;
}

.list-row-primary {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.list-vertical-divider {
    width: 1px;
    height: 40px;
    background-color: var(--border-color);
    flex-shrink: 0;
}

.list-right-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.avatar-small {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.name-text {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.number-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.email-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.list-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.call-icon-btn {
    background-color: #eff6ff;
    color: var(--primary-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color 0.2s;
}

.call-icon-btn:hover {
    background-color: #e0e7ff;
}

.call-btn-list {
    background-color: #eff6ff;
    color: var(--primary-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    text-decoration: none;
    font-size: 0.9rem;
}

.call-btn-list:hover {
    background-color: #e0e7ff;
}

.contact-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(99, 102, 241, 0.2);
}

.list-view .contact-card:hover {
    transform: none;
    background-color: #f9fafb;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.list-view .card-header {
    margin-bottom: 0;
    flex: 0 0 auto;
}

.avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Unified Actions for both views */
.card-view-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-view .card-view-actions {
    position: static;
    margin-left: auto;
    /* Push to extreme right */
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.menu-btn:hover {
    background-color: var(--bg-color);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    min-width: 120px;
    z-index: 20;
    border: 1px solid var(--border-color);
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    background: none;
    border: none;
    text-align: left;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-primary);
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.dropdown-item.delete-btn:hover {
    color: var(--error-color);
    background-color: #fef2f2;
}

/* Contact Info */
.contact-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.list-view .contact-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    min-width: 0;
    /* Crucial for flex child truncation */
    flex: 1;
}

.contact-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.list-view .contact-info h3 {
    margin-bottom: 0;
    min-width: 150px;
    /* Reduced min-width */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.org-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: block;
}

.list-view .org-name {
    margin-bottom: 0;
    min-width: 100px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 10px;
}

.list-view .contact-details {
    flex-direction: row;
    gap: 2rem;
    flex: 1;
    min-width: 0;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.detail-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-item i {
    width: 16px;
    color: var(--primary-color);
}

.call-btn {
    margin-top: auto;
    /* Push to bottom */
    width: 100%;
    background-color: #eff6ff;
    color: var(--primary-color);
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    text-decoration: none;
}

.call-btn:hover {
    background-color: #e0e7ff;
}

/* Green Call Button for Favorites */
.contact-card.favorite .call-btn {
    background-color: #10b981;
    /* Emerald 500 */
    color: white;
}

.contact-card.favorite .call-btn:hover {
    background-color: #059669;
    /* Emerald 600 */
}

.list-view .call-btn {
    display: flex;
    /* Show call button in list view */
    width: auto;
    margin-top: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Favorite Button */
.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #d1d5db;
    /* Gray */
    transition: color 0.2s, transform 0.2s;
    font-size: 1.25rem;
    padding: 0.5rem;
}

.fav-btn:hover {
    transform: scale(1.1);
}

.fav-btn.active {
    color: var(--error-color);
    /* Red */
}

.fav-btn.active i {
    font-weight: 900;
}

.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
}

.spinner {
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .list-view .contact-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .list-left-section {
        width: 100%;
        flex-direction: row;
        align-items: flex-start;
        gap: 1rem;
    }

    .list-info-group {
        width: 100%;
    }

    .list-row-primary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .list-vertical-divider {
        display: none;
    }

    .list-right-section {
        width: 100%;
        justify-content: space-between;
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
        margin-top: 0.5rem;
    }

    .call-btn-list {
        flex: 1;
        justify-content: center;
    }
}